[libc++] Make sure we forward stdin through executors (#67064)
This allows running tests like the ones for std::cin even on SSH
executors. This was originally reported as
https://github.com/llvm/llvm-project/pull/66842#issuecomment-1728701639.
diff --git a/libcxx/utils/ssh.py b/libcxx/utils/ssh.py
index e1eaa5a..ec16efc 100755
--- a/libcxx/utils/ssh.py
+++ b/libcxx/utils/ssh.py
@@ -62,7 +62,8 @@
ssh("mktemp -d {}/libcxx.XXXXXXXXXX".format(args.tempdir)),
universal_newlines=True,
check=True,
- capture_output=True
+ capture_output=True,
+ stdin=subprocess.DEVNULL
).stdout.strip()
# HACK:
@@ -80,7 +81,7 @@
if args.codesign_identity:
for exe in filter(isTestExe, commandLine):
codesign = ["codesign", "-f", "-s", args.codesign_identity, exe]
- runCommand(codesign, env={}, check=True)
+ runCommand(codesign, env={}, check=True, stdin=subprocess.DEVNULL)
# tar up the execution directory (which contains everything that's needed
# to run the test), and copy the tarball over to the remote host.
@@ -93,7 +94,7 @@
# the temporary file while still open doesn't work on Windows.
tmpTar.close()
remoteTarball = pathOnRemote(tmpTar.name)
- runCommand(scp(tmpTar.name, remoteTarball), check=True)
+ runCommand(scp(tmpTar.name, remoteTarball), check=True, stdin=subprocess.DEVNULL)
finally:
# Make sure we close the file in case an exception happens before
# we've closed it above -- otherwise close() is idempotent.
@@ -130,6 +131,8 @@
remoteCommands.append(subprocess.list2cmdline(commandLine))
# Finally, SSH to the remote host and execute all the commands.
+ # Make sure to forward stdin to the process so that the test suite
+ # can pipe stuff into the executor.
rc = runCommand(ssh(" && ".join(remoteCommands))).returncode
return rc