From 674769a29e25ed5ee0e186207f88374f49b638a1 Mon Sep 17 00:00:00 2001 From: Alexander Bluhm Date: Wed, 24 Jan 2024 22:34:18 +0100 Subject: [PATCH] Netbench dies with failure if any process failed. --- netbench.pl | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/netbench.pl b/netbench.pl index 44b23368..76a4d25b 100755 --- a/netbench.pl +++ b/netbench.pl @@ -161,6 +161,10 @@ print_status_tcp() if $testmode{tcp}; print_status_udp() if $testmode{udp}; +my @failed = map { $_->{status} ? $_->{name} : () } + (@clients, @relays, @servers); +die "Process '@failed' failed" if @failed; + exit; sub start_server_tcp { @@ -365,9 +369,12 @@ sub read_output { } } unless ($!{EWOULDBLOCK}) { - close($proc->{fh}) or warn $! ? - "Close pipe from proc $proc->{name} '@{$proc->{cmd}}' failed: $!" : - "Proc $proc->{name} '@{$proc->{cmd}}' failed: $?"; + unless (close($proc->{fh})) { + die "Close pipe from proc $proc->{name} '@{$proc->{cmd}}' ". + "failed: $!" if $!; + warn "Proc $proc->{name} '@{$proc->{cmd}}' failed: $?"; + $proc->{status} = $?; + } delete $proc->{fh}; delete $proc->{pid}; }