When PostgresNode::system_or_bail() fails, it's quite opaque as to what
is happening.  This patch improves things by printing some detail, as
suggested in Perl's doc for system().

-- 
Álvaro Herrera                            39°49'30"S 73°17'W
                               https://www.EnterpriseDB.com/
AuthorDate: Tue Jun 15 12:46:42 2021 -0400
CommitDate: Tue Jun 15 12:46:54 2021 -0400

    improve TestLib::system_or_bail reporting of system() failures

diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm
index 26fbe08d4b..eb49923b42 100644
--- a/src/test/perl/TestLib.pm
+++ b/src/test/perl/TestLib.pm
@@ -375,7 +375,18 @@ sub system_or_bail
 {
 	if (system_log(@_) != 0)
 	{
-		BAIL_OUT("system $_[0] failed");
+		if ($? == -1)
+		{
+			BAIL_OUT("system $_[0] failed: $!\n");
+		}
+		elsif ($? & 127)
+		{
+			BAIL_OUT(sprintf("system $_[0] died with signal %d\n", $? & 127));
+		}
+		else
+		{
+			BAIL_OUT(sprintf("system $_[0] exited with value %d\n", $? >> 8));
+		}
 	}
 	return;
 }

Reply via email to