Commit 199e17c7 authored by Antoine Catton's avatar Antoine Catton

Cleanup how the environment is overriden before exec'ing

parent 40f92aae
...@@ -64,22 +64,20 @@ child_pg = None ...@@ -64,22 +64,20 @@ child_pg = None
def executee(args): def executee(args):
"""Portable execution with process replacement and environment manipulation""" """Portable execution with process replacement and environment manipulation"""
exec_list = list(args[0]) exec_list = list(args[0])
environment = args[1] environment_overriding = args[1]
env = os.environ.copy() exec_env = os.environ.copy()
for k,v in environment.iteritems(): exec_env.update(environment_overriding)
env[k] = v os.execve(exec_list[0], exec_list + sys.argv[1:], exec_env)
os.execve(exec_list[0], exec_list + sys.argv[1:], env)
def executee_wait(args): def executee_wait(args):
"""Portable execution with process replacement and environment manipulation""" """Portable execution with process replacement and environment manipulation"""
exec_list = list(args[0]) exec_list = list(args[0])
file_list = list(args[1]) file_list = list(args[1])
environment = args[2] environment_overriding = args[2]
env = os.environ.copy() exec_env = os.environ.copy()
for k,v in environment.iteritems(): exec_env.update(environment_overriding)
env[k] = v
_wait_files_creation(file_list) _wait_files_creation(file_list)
os.execve(exec_list[0], exec_list + sys.argv[1:], env) os.execve(exec_list[0], exec_list + sys.argv[1:], exec_env)
def sig_handler(signal, frame): def sig_handler(signal, frame):
print 'Received signal %r, killing children and exiting' % signal print 'Received signal %r, killing children and exiting' % signal
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment