def handle_process_exit_code(exit_code):
 if os.WIFSIGNALED(exit_code):
  exit_code = (- os.WTERMSIG(exit_code))
 elif os.WIFEXITED(exit_code):
  exit_code = os.WEXITSTATUS(exit_code)
 else:
  raise RuntimeError('Unknown child exit status!')
 return exit_code

def handle_process_exit_code ( exit_code ) : if os . WIFSIGNALED ( exit_code ) : exit_code = ( - os . WTERMSIG ( exit_code ) ) elif os . WIFEXITED ( exit_code ) : exit_code = os . WEXITSTATUS ( exit_code ) else : raise RuntimeError ( 'Unknown child exit status!' ) return exit_code
this should only ever be called once for each child process .