Commit a9387b05 authored by David Wilson's avatar David Wilson

core: remove pointless eval() of ARGV0 environment variable.

parent 1411790f
...@@ -657,6 +657,7 @@ class Stream(BasicStream): ...@@ -657,6 +657,7 @@ class Stream(BasicStream):
LOG.debug('%r.on_shutdown(%r)', self, broker) LOG.debug('%r.on_shutdown(%r)', self, broker)
def accept(self, rfd, wfd): def accept(self, rfd, wfd):
# TODO: what is this os.dup for?
self.receive_side = Side(self, os.dup(rfd)) self.receive_side = Side(self, os.dup(rfd))
self.transmit_side = Side(self, os.dup(wfd)) self.transmit_side = Side(self, os.dup(wfd))
set_cloexec(self.receive_side.fd) set_cloexec(self.receive_side.fd)
...@@ -1184,7 +1185,7 @@ class ExternalContext(object): ...@@ -1184,7 +1185,7 @@ class ExternalContext(object):
self.router.register(self.parent, self.stream) self.router.register(self.parent, self.stream)
sys.executable, = eval(os.environ.pop('ARGV0')) sys.executable = os.environ.pop('ARGV0', sys.executable)
LOG.debug('Connected to %s; my ID is %r, PID is %r', LOG.debug('Connected to %s; my ID is %r, PID is %r',
self.parent, context_id, os.getpid()) self.parent, context_id, os.getpid())
LOG.debug('Recovered sys.executable: %r', sys.executable) LOG.debug('Recovered sys.executable: %r', sys.executable)
......
...@@ -384,7 +384,7 @@ def run(dest, router, args, deadline=None, econtext=None): ...@@ -384,7 +384,7 @@ def run(dest, router, args, deadline=None, econtext=None):
env = os.environ.copy() env = os.environ.copy()
env.update({ env.update({
'PATH': '%s:%s' % (tmp_path, env.get('PATH', '')), 'PATH': '%s:%s' % (tmp_path, env.get('PATH', '')),
'ARGV0': `[sys.executable]`, 'ARGV0': sys.executable,
'SSH_PATH': ssh_path, 'SSH_PATH': ssh_path,
}) })
......
...@@ -588,7 +588,7 @@ class Stream(mitogen.core.Stream): ...@@ -588,7 +588,7 @@ class Stream(mitogen.core.Stream):
os.dup2(R,0) os.dup2(R,0)
os.dup2(R2,101) os.dup2(R2,101)
for f in R,R2,W,W2: os.close(f) for f in R,R2,W,W2: os.close(f)
os.environ['ARGV0'] = `[sys.executable]` os.environ['ARGV0'] = sys.executable
os.execv(sys.executable,['mitogen:CONTEXT_NAME']) os.execv(sys.executable,['mitogen:CONTEXT_NAME'])
else: else:
os.write(1, 'EC0\n') os.write(1, 'EC0\n')
......
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