Skip to content

Commit 1c0dd57

Browse files
committed
[libc++] Use 'export' instead of 'env' to run remote commands
This allows running commands that use shell builtins remotely too, when 'env' would complain that it can't find the program.
1 parent 2dee4d4 commit 1c0dd57

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

libcxx/utils/ssh.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,12 @@ def main():
7878

7979
# Execute the command through SSH in the temporary directory, with the
8080
# correct environment.
81-
command = [exe] + remaining if exe else remaining
82-
res = subprocess.call(ssh('cd {} && env -i {} {}'.format(tmp, ' '.join(args.env), ' '.join(command))))
81+
commands = [
82+
'cd {}'.format(tmp),
83+
'export {}'.format(' '.join(args.env)),
84+
' '.join([exe] + remaining if exe else remaining)
85+
]
86+
res = subprocess.call(ssh(' && '.join(commands)))
8387

8488
# Remove the temporary directory when we're done.
8589
subprocess.call(ssh('rm -r {}'.format(tmp)))

0 commit comments

Comments
 (0)