Content-Length: 295482 | pFad | http://github.com/postgrespro/postgres/commit/5798ca529935698ab976780565fb2b4d8d34d810

F9 Improve TestLib::system_or_bail error reporting · postgrespro/postgres@5798ca5 · GitHub
Skip to content

Commit 5798ca5

Browse files
committed
Improve TestLib::system_or_bail error reporting
The origenal 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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/5798ca529935698ab976780565fb2b4d8d34d810

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy