MCPcopy
hub / github.com/celery/celery / _setgroups_hack

Function _setgroups_hack

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

Source from the content-addressed store, hash-verified

464
465
466def _setgroups_hack(groups):
467 # :fun:`setgroups` may have a platform-dependent limit,
468 # and it's not always possible to know in advance what this limit
469 # is, so we use this ugly hack stolen from glibc.
470 groups = groups[:]
471
472 while 1:
473 try:
474 return os.setgroups(groups)
475 except ValueError: # error from Python's check.
476 if len(groups) <= 1:
477 raise
478 groups[:] = groups[:-1]
479 except OSError as exc: # error from the OS.
480 if exc.errno != errno.EINVAL or len(groups) <= 1:
481 raise
482 groups[:] = groups[:-1]
483
484
485def setgroups(groups):

Callers 3

setgroupsFunction · 0.85

Calls

no outgoing calls

Tested by 2