MCPcopy Create free account
hub / github.com/celery/celery / _setgroups_hack

Function _setgroups_hack

celery/platforms.py:530–546  ·  view source on GitHub ↗
(groups)

Source from the content-addressed store, hash-verified

528
529
530def _setgroups_hack(groups):
531 # :fun:`setgroups` may have a platform-dependent limit,
532 # and it's not always possible to know in advance what this limit
533 # is, so we use this ugly hack stolen from glibc.
534 groups = groups[:]
535
536 while 1:
537 try:
538 return os.setgroups(groups)
539 except ValueError: # error from Python's check.
540 if len(groups) <= 1:
541 raise
542 groups[:] = groups[:-1]
543 except OSError as exc: # error from the OS.
544 if exc.errno != errno.EINVAL or len(groups) <= 1:
545 raise
546 groups[:] = groups[:-1]
547
548
549def setgroups(groups):

Callers 3

setgroupsFunction · 0.85

Calls

no outgoing calls

Tested by 2