From: Brian Warner Date: Mon, 1 Jun 2009 21:01:37 +0000 (-0700) Subject: misc/run-with-pythonpath.py: exec() the child (on unix), to remove the intermediate... X-Git-Tag: trac-3900~9 X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/%22doc.html/architecture.txt?a=commitdiff_plain;h=8e2506675355ddafcbaa9c999cdb8f636384a1e4;p=tahoe-lafs%2Ftahoe-lafs.git misc/run-with-pythonpath.py: exec() the child (on unix), to remove the intermediate process --- diff --git a/misc/run-with-pythonpath.py b/misc/run-with-pythonpath.py index e23a15de..d402f7c5 100644 --- a/misc/run-with-pythonpath.py +++ b/misc/run-with-pythonpath.py @@ -34,6 +34,17 @@ if oldpp == [""]: newpp = os.pathsep.join(oldpp + [supportlib,]) os.environ['PYTHONPATH'] = newpp -command = sys.argv[1:] -rc = subprocess.call(command) -sys.exit(rc) +if sys.platform == "win32": + command = sys.argv[1:] + rc = subprocess.call(command) + sys.exit(rc) +else: + from twisted.python.procutils import which + cmd = sys.argv[1] + if cmd and cmd[0] not in "/~.": + cmds = which(cmd) + if not cmds: + print >>sys.stderr, "'%s' not found on PATH" % (cmd,) + sys.exit(-1) + cmd = cmds[0] + os.execve(cmd, sys.argv[1:], os.environ)