Skip to content

Commit 5798ca5

Browse files
committed
Improve TestLib::system_or_bail error reporting
The original coding was not quoting the complete failing command, and it wasn't printing the reason for the failure either. Do both. This is cosmetic only, so no backpatch. Author: Álvaro Herrera <alvherre@alvh.no-ip.org> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Daniel Gustafsson <daniel@yesql.se> Discussion: https://postgr.es/m/202106301524.eq5pblzstapj@alvherre.pgsql
1 parent 64919aa commit 5798ca5

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

src/test/perl/TestLib.pm

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,9 +375,29 @@ sub system_or_bail
375375
{
376376
if (system_log(@_) != 0)
377377
{
378-
BAIL_OUT("system $_[0] failed");
378+
if ($? == -1)
379+
{
380+
BAIL_OUT(
381+
sprintf(
382+
"failed to execute command \"%s\": $!", join(" ", @_)));
383+
}
384+
elsif ($? & 127)
385+
{
386+
BAIL_OUT(
387+
sprintf(
388+
"command \"%s\" died with signal %d",
389+
join(" ", @_),
390+
$? & 127));
391+
}
392+
else
393+
{
394+
BAIL_OUT(
395+
sprintf(
396+
"command \"%s\" exited with value %d",
397+
join(" ", @_),
398+
$? >> 8));
399+
}
379400
}
380-
return;
381401
}
382402

383403
=pod

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy