[PATCH] Tests: improved has_daemon() to drop "which" stderr

Maxim Dounin mdounin at mdounin.ru
Thu May 2 16:59:10 UTC 2024


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1714669097 -10800
#      Thu May 02 19:58:17 2024 +0300
# Node ID c25ada43ab4fb71ea1e8a73e59883fc00c24dd92
# Parent  fe6f22da53ec760f7ab138d1d32b7a03ea7bdea3
Tests: improved has_daemon() to drop "which" stderr.

On some platforms (notably OpenBSD) "which" prints an error if the command
is not found.  It is now dropped to produce less clutter during testing.

diff --git a/lib/Test/Nginx.pm b/lib/Test/Nginx.pm
--- a/lib/Test/Nginx.pm
+++ b/lib/Test/Nginx.pm
@@ -336,7 +336,7 @@ sub has_daemon($) {
 	}
 
 	Test::More::plan(skip_all => "$daemon not found")
-		unless `which $daemon`;
+		unless `which $daemon 2>/dev/null`;
 
 	return $self;
 }




More information about the nginx-devel mailing list