This avoids a pylint too-many-nested-blocks warning. The extra try: finally: os._exit(1) is unnecessary as _StartDaemonChild already catches all its exceptions and if it ever finishes, calls os._exit(1) anyways.
Signed-off-by: Brian Foley <[email protected]> --- lib/utils/process.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/utils/process.py b/lib/utils/process.py index 9183e9f..bb5aed2 100644 --- a/lib/utils/process.py +++ b/lib/utils/process.py @@ -360,15 +360,11 @@ def StartDaemon(cmd, env=None, cwd="/", output=None, output_fd=None, # First fork pid = os.fork() if pid == 0: - try: - # Child process, won't return - _StartDaemonChild(errpipe_read, errpipe_write, - pidpipe_read, pidpipe_write, - cmd, cmd_env, cwd, - output, output_fd, pidfile) - finally: - # Well, maybe child process failed - os._exit(1) # pylint: disable=W0212 + # Child process, can't return. + _StartDaemonChild(errpipe_read, errpipe_write, + pidpipe_read, pidpipe_write, + cmd, cmd_env, cwd, + output, output_fd, pidfile) finally: utils_wrapper.CloseFdNoError(errpipe_write) -- 2.8.0.rc3.226.g39d4020
