Kill the shell process after the Mock server is running,
to prevent the shell from printing an error message when
the Mock server is finally killed.
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27144)
if ($server_host eq '*' || $server_port == 0) {
# Find out the actual server host and port and possibly different PID
my ($host, $port);
- $pid = 0;
+ my $pid0 = $pid;
while (<$server_fh>) {
print "$server_name server output: $_";
next if m/using section/;
$server_host = "127.0.0.1" if $host eq "0.0.0.0";
}
$server_port = $port if $server_port == 0 && defined $port;
+ if ($pid0 != $pid) {
+ # kill the shell process
+ kill('KILL', $pid0);
+ waitpid($pid0, 0);
+ }
}
if ($server_host eq '*' || $server_port == 0) {
stop_server($server_name, $pid) if $pid;