##// END OF EJS Templates
dummyssh: use subprocess instead of os.call...
marmoute -
r48440:119673fb default
parent child Browse files
Show More
@@ -1,26 +1,27 b''
1 #!/usr/bin/env python3
1 #!/usr/bin/env python3
2
2
3 from __future__ import absolute_import
3 from __future__ import absolute_import
4
4
5 import os
5 import os
6 import subprocess
6 import sys
7 import sys
7
8
8 os.chdir(os.getenv('TESTTMP'))
9 os.chdir(os.getenv('TESTTMP'))
9
10
10 if sys.argv[1] != "user@dummy":
11 if sys.argv[1] != "user@dummy":
11 sys.exit(-1)
12 sys.exit(-1)
12
13
13 os.environ["SSH_CLIENT"] = "%s 1 2" % os.environ.get('LOCALIP', '127.0.0.1')
14 os.environ["SSH_CLIENT"] = "%s 1 2" % os.environ.get('LOCALIP', '127.0.0.1')
14
15
15 log = open("dummylog", "ab")
16 log = open("dummylog", "ab")
16 log.write(b"Got arguments")
17 log.write(b"Got arguments")
17 for i, arg in enumerate(sys.argv[1:]):
18 for i, arg in enumerate(sys.argv[1:]):
18 log.write(b" %d:%s" % (i + 1, arg.encode('latin1')))
19 log.write(b" %d:%s" % (i + 1, arg.encode('latin1')))
19 log.write(b"\n")
20 log.write(b"\n")
20 log.close()
21 log.close()
21 hgcmd = sys.argv[2]
22 hgcmd = sys.argv[2]
22 if os.name == 'nt':
23 if os.name == 'nt':
23 # hack to make simple unix single quote quoting work on windows
24 # hack to make simple unix single quote quoting work on windows
24 hgcmd = hgcmd.replace("'", '"')
25 hgcmd = hgcmd.replace("'", '"')
25 r = os.system(hgcmd)
26 r = subprocess.call(hgcmd, shell=True)
26 sys.exit(bool(r))
27 sys.exit(bool(r))
General Comments 0
You need to be logged in to leave comments. Login now