mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-19 03:06:33 +00:00
misc/run-with-pythonpath.py: exec() the child (on unix), to remove the intermediate process
This commit is contained in:
parent
9a02f4a104
commit
8e25066753
@ -34,6 +34,17 @@ if oldpp == [""]:
|
|||||||
newpp = os.pathsep.join(oldpp + [supportlib,])
|
newpp = os.pathsep.join(oldpp + [supportlib,])
|
||||||
os.environ['PYTHONPATH'] = newpp
|
os.environ['PYTHONPATH'] = newpp
|
||||||
|
|
||||||
command = sys.argv[1:]
|
if sys.platform == "win32":
|
||||||
rc = subprocess.call(command)
|
command = sys.argv[1:]
|
||||||
sys.exit(rc)
|
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user