Commit a8f53337 authored by Vincent Pelletier's avatar Vincent Pelletier

Exec scripts in the same (forked) interpreter.

Avoid switching to an unexpected interpreter after forking.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2230 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 7755bc02
...@@ -82,12 +82,18 @@ class NEOProcess(object): ...@@ -82,12 +82,18 @@ class NEOProcess(object):
if self.pid == 0: if self.pid == 0:
# Child # Child
try: try:
os.execlp(command, command, *args) sys.argv = [command] + args
execfile(command, {})
except (SystemExit, KeyboardInterrupt):
self._exit()
except: except:
print traceback.format_exc() print traceback.format_exc()
# If we reach this line, exec call failed (is it possible to reach # If we reach this line, exec call failed (is it possible to reach
# it without going through above "except" branch ?). # it without going through above "except" branch ?).
print 'Error executing %r.' % (command + ' ' + ' '.join(args), ) print 'Error executing %r.' % (command + ' ' + ' '.join(args), )
self._exit()
def _exit(self):
# KeyboardInterrupt is not intercepted by test runner (it is still # KeyboardInterrupt is not intercepted by test runner (it is still
# above us in the stack), and we do want to exit. # above us in the stack), and we do want to exit.
# To avoid polluting test foreground output with induced # To avoid polluting test foreground output with induced
......
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