summaryrefslogtreecommitdiff
path: root/tests/sshserver.pl
diff options
context:
space:
mode:
authorMarc Hoersken <info@marc-hoersken.de>2021-08-17 21:16:41 +0200
committerMarc Hoersken <info@marc-hoersken.de>2021-08-18 20:59:36 +0200
commit5b1c2dd1db6465f4664becc9a8b686e4151fae68 (patch)
treee038209384d9d5a1a6e36ea7baa859998867f898 /tests/sshserver.pl
parentebefa3b9f0d0684bba83feb440376e641bf8193d (diff)
downloadcurl-5b1c2dd1db6465f4664becc9a8b686e4151fae68.tar.gz
tests/*server.pl: flush output before executing subprocess
Also avoid shell processes staying around by using exec. This is necessary to avoid output data being buffering inside the process chain of Perl, Bash/Shell and our test server binaries. On non-Windows systems the exec will also make the subprocess replace the intermediate shell, but on Windows it will at least bind the processes together since there is no real fork or exec available. See: https://cygwin.com/cygwin-ug-net/highlights.html and: https://docs.microsoft.com/cpp/c-runtime-library/exec-wexec-functions Ref: https://github.com/curl/curl/pull/7530#issuecomment-900949010 Reviewed-by: Daniel Stenberg Reviewed-by: Jay Satiro Closes #7530
Diffstat (limited to 'tests/sshserver.pl')
-rw-r--r--tests/sshserver.pl3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/sshserver.pl b/tests/sshserver.pl
index 944193907..90281eb40 100644
--- a/tests/sshserver.pl
+++ b/tests/sshserver.pl
@@ -1122,6 +1122,9 @@ if ($sshdid =~ /OpenSSH-Windows/) {
close(OUT);
}
+ # Flush output.
+ $| = 1;
+
# Put an "exec" in front of the command so that the child process
# keeps this child's process ID by being tied to the spawned shell.
exec("exec $cmd") || die "Can't exec() $cmd: $!";