Revision b459a848 lib/utils/process.py
b/lib/utils/process.py | ||
---|---|---|
57 | 57 |
"""Disables the use of fork(2). |
58 | 58 |
|
59 | 59 |
""" |
60 |
global _no_fork # pylint: disable-msg=W0603
|
|
60 |
global _no_fork # pylint: disable=W0603 |
|
61 | 61 |
|
62 | 62 |
_no_fork = True |
63 | 63 |
|
... | ... | |
342 | 342 |
output, output_fd, pidfile) |
343 | 343 |
finally: |
344 | 344 |
# Well, maybe child process failed |
345 |
os._exit(1) # pylint: disable-msg=W0212
|
|
345 |
os._exit(1) # pylint: disable=W0212 |
|
346 | 346 |
finally: |
347 | 347 |
utils_wrapper.CloseFdNoError(errpipe_write) |
348 | 348 |
|
... | ... | |
396 | 396 |
pid = os.fork() |
397 | 397 |
if pid != 0: |
398 | 398 |
# Exit first child process |
399 |
os._exit(0) # pylint: disable-msg=W0212
|
|
399 |
os._exit(0) # pylint: disable=W0212 |
|
400 | 400 |
|
401 | 401 |
# Make sure pipe is closed on execv* (and thereby notifies |
402 | 402 |
# original process) |
... | ... | |
431 | 431 |
os.execvp(args[0], args) |
432 | 432 |
else: |
433 | 433 |
os.execvpe(args[0], args, env) |
434 |
except: # pylint: disable-msg=W0702
|
|
434 |
except: # pylint: disable=W0702 |
|
435 | 435 |
try: |
436 | 436 |
# Report errors to original process |
437 | 437 |
WriteErrorToFD(errpipe_write, str(sys.exc_info()[1])) |
438 |
except: # pylint: disable-msg=W0702
|
|
438 |
except: # pylint: disable=W0702 |
|
439 | 439 |
# Ignore errors in error handling |
440 | 440 |
pass |
441 | 441 |
|
442 |
os._exit(1) # pylint: disable-msg=W0212
|
|
442 |
os._exit(1) # pylint: disable=W0212 |
|
443 | 443 |
|
444 | 444 |
|
445 | 445 |
def WriteErrorToFD(fd, err): |
... | ... | |
699 | 699 |
else: |
700 | 700 |
try: |
701 | 701 |
result = RunCmd([fname], env=env, reset_env=reset_env) |
702 |
except Exception, err: # pylint: disable-msg=W0703
|
|
702 |
except Exception, err: # pylint: disable=W0703 |
|
703 | 703 |
rr.append((relname, constants.RUNPARTS_ERR, str(err))) |
704 | 704 |
else: |
705 | 705 |
rr.append((relname, constants.RUNPARTS_RUN, result)) |
... | ... | |
850 | 850 |
process and a callable to reopen log files |
851 | 851 |
|
852 | 852 |
""" |
853 |
# pylint: disable-msg=W0212
|
|
853 |
# pylint: disable=W0212 |
|
854 | 854 |
# yes, we really want os._exit |
855 | 855 |
|
856 | 856 |
# TODO: do another attempt to merge Daemonize and StartDaemon, or at |
... | ... | |
975 | 975 |
# Call function |
976 | 976 |
result = int(bool(fn(*args))) |
977 | 977 |
assert result in (0, 1) |
978 |
except: # pylint: disable-msg=W0702
|
|
978 |
except: # pylint: disable=W0702 |
|
979 | 979 |
logging.exception("Error while calling function in separate process") |
980 | 980 |
# 0 and 1 are reserved for the return value |
981 | 981 |
result = 33 |
982 | 982 |
|
983 |
os._exit(result) # pylint: disable-msg=W0212
|
|
983 |
os._exit(result) # pylint: disable=W0212 |
|
984 | 984 |
|
985 | 985 |
# Parent process |
986 | 986 |
|
Also available in: Unified diff