diff --git a/libcxx/utils/ssh.py b/libcxx/utils/ssh.py --- a/libcxx/utils/ssh.py +++ b/libcxx/utils/ssh.py @@ -23,6 +23,11 @@ import tarfile import tempfile +try: + from shlex import quote as cmd_quote +except ImportError: + from pipes import quote as cmd_quote + def ssh(args, command): cmd = ['ssh', '-oBatchMode=yes'] if args.extra_ssh_args is not None: @@ -107,7 +112,7 @@ commandLine = (pathOnRemote(x) if isTestExe(x) else x for x in commandLine) remoteCommands.append('cd {}'.format(tmp)) if args.env: - remoteCommands.append('export {}'.format(' '.join(args.env))) + remoteCommands.append('export {}'.format(cmd_quote(' '.join(args.env)))) remoteCommands.append(subprocess.list2cmdline(commandLine)) # Finally, SSH to the remote host and execute all the commands.