[libcxx-commits] [libcxx] 1c0dd57 - [libc++] Use 'export' instead of 'env' to run remote commands

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 31 14:12:15 PDT 2020


Author: Louis Dionne
Date: 2020-03-31T17:11:28-04:00
New Revision: 1c0dd57cd3e253b2ac7036366ef91e286422c830

URL: https://github.com/llvm/llvm-project/commit/1c0dd57cd3e253b2ac7036366ef91e286422c830
DIFF: https://github.com/llvm/llvm-project/commit/1c0dd57cd3e253b2ac7036366ef91e286422c830.diff

LOG: [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.

Added: 
    

Modified: 
    libcxx/utils/ssh.py

Removed: 
    


################################################################################
diff  --git a/libcxx/utils/ssh.py b/libcxx/utils/ssh.py
index 20acaeb00e3d..02e1e3bddc85 100644
--- a/libcxx/utils/ssh.py
+++ b/libcxx/utils/ssh.py
@@ -78,8 +78,12 @@ def main():
 
     # Execute the command through SSH in the temporary directory, with the
     # correct environment.
-    command = [exe] + remaining if exe else remaining
-    res = subprocess.call(ssh('cd {} && env -i {} {}'.format(tmp, ' '.join(args.env), ' '.join(command))))
+    commands = [
+        'cd {}'.format(tmp),
+        'export {}'.format(' '.join(args.env)),
+        ' '.join([exe] + remaining if exe else remaining)
+    ]
+    res = subprocess.call(ssh(' && '.join(commands)))
 
     # Remove the temporary directory when we're done.
     subprocess.call(ssh('rm -r {}'.format(tmp)))


        


More information about the libcxx-commits mailing list