diff --git a/hack/test-port-forwarding.pl b/hack/test-port-forwarding.pl index 8245cf9396e..3a41ce1e118 100755 --- a/hack/test-port-forwarding.pl +++ b/hack/test-port-forwarding.pl @@ -54,6 +54,17 @@ exit; } +# Check if netcat is available before running tests +my $nc_path = `command -v nc 2>/dev/null`; +chomp $nc_path; +unless ($nc_path) { + die "Error: 'nc' (netcat) is not installed on the host system.\n" . + "Please install netcat to run this test script:\n" . + " - On macOS: brew install netcat\n" . + " - On Ubuntu/Debian: sudo apt-get install netcat\n" . + " - On RHEL/CentOS: sudo yum install nmap-ncat\n"; +} + # Otherwise $instance must be the name of an already running instance that has been # configured with our portForwards settings.