##// END OF EJS Templates
dummyssh: make sure we don't inherit files descriptor to the children...
marmoute -
r48574:fb8389f2 stable
parent child Browse files
Show More
@@ -1,35 +1,35 b''
1 1 #!/usr/bin/env python3
2 2
3 3 from __future__ import absolute_import
4 4
5 5 import os
6 6 import shlex
7 7 import subprocess
8 8 import sys
9 9
10 10 os.chdir(os.getenv('TESTTMP'))
11 11
12 12 if sys.argv[1] != "user@dummy":
13 13 sys.exit(-1)
14 14
15 15 os.environ["SSH_CLIENT"] = "%s 1 2" % os.environ.get('LOCALIP', '127.0.0.1')
16 16
17 17 log = open("dummylog", "ab")
18 18 log.write(b"Got arguments")
19 19 for i, arg in enumerate(sys.argv[1:]):
20 20 log.write(b" %d:%s" % (i + 1, arg.encode('latin1')))
21 21 log.write(b"\n")
22 22 log.close()
23 23 hgcmd = sys.argv[2]
24 24 if os.name == 'nt':
25 25 # hack to make simple unix single quote quoting work on windows
26 26 hgcmd = hgcmd.replace("'", '"')
27 27 cmds = shlex.split(hgcmd)
28 28 if cmds[0].endswith('.py'):
29 29 python_exe = os.environ['PYTHON']
30 30 cmds.insert(0, python_exe)
31 31 hgcmd = shlex.join(cmds)
32 32 # shlex generate windows incompatible string...
33 33 hgcmd = hgcmd.replace("'", '"')
34 r = subprocess.call(hgcmd, shell=True)
34 r = subprocess.call(hgcmd, shell=True, close_fds=True)
35 35 sys.exit(bool(r))
General Comments 0
You need to be logged in to leave comments. Login now