Compare commits

...

3 Commits

Author SHA1 Message Date
jddurand 3eed1d42d8
Merge f54fc33c3b into ac87f6b3a3 2025-07-16 07:03:08 +01:00
Jean-Damien Durand f54fc33c3b Typo 'need' => 'needs' in a comment 2022-10-31 16:36:02 +01:00
Jean-Damien Durand b3f7648c88 Revisit how underlying openssl processes output is proxied in tests 2022-10-27 13:57:18 +02:00
1 changed files with 9 additions and 11 deletions

View File

@ -378,21 +378,19 @@ sub start
# server's output and printing it as long as there is anything there,
# out of our way.
my $error;
$pid = undef;
if (eval { require Win32::Process; 1; }) {
if (Win32::Process::Create(my $h, $^X, "perl -ne print", 0, 0, ".")) {
$pid = $h->GetProcessID();
$self->{proc_handle} = $h; # hold handle till next round [or exit]
} else {
$error = Win32::FormatMessage(Win32::GetLastError());
}
} else {
open(my $dupstdin, "<&STDIN") or die "Failed to dup STDIN, $!";
if (defined($pid = fork)) {
$pid or exec("$^X -ne print") or exit($!);
if ($pid) {
close($dupstdin) or warn "Failed to close dupped STDIN, $!"; # Only the child needs it
} else {
while (defined($_ = <$dupstdin>)) {
print $_;
}
exit(0);
}
} else {
$error = $!;
}
}
# Change back to original stdin
open(STDIN, "<&", $savedin);