projects
/
postgresql.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
64919aa
)
Improve TestLib::system_or_bail error reporting
author
Alvaro Herrera
<
[email protected]
>
Tue, 6 Jul 2021 21:48:41 +0000
(17:48 -0400)
committer
Alvaro Herrera
<
[email protected]
>
Tue, 6 Jul 2021 21:51:59 +0000
(17:51 -0400)
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 <
[email protected]
>
Reviewed-by: Tom Lane <
[email protected]
>
Reviewed-by: Daniel Gustafsson <
[email protected]
>
Discussion: https://postgr.es/m/
202106301524
[email protected]
src/test/perl/TestLib.pm
patch
|
blob
|
blame
|
history
diff --git
a/src/test/perl/TestLib.pm
b/src/test/perl/TestLib.pm
index 26fbe08d4be82f05b768c3f20392f98aa83783a7..15572abbea403994f834b193a8dbdf2824240ac6 100644
(file)
--- a/
src/test/perl/TestLib.pm
+++ b/
src/test/perl/TestLib.pm
@@
-375,9
+375,29
@@
sub system_or_bail
{
if (system_log(@_) != 0)
{
- BAIL_OUT("system $_[0] failed");
+ if ($? == -1)
+ {
+ BAIL_OUT(
+ sprintf(
+ "failed to execute command \"%s\": $!", join(" ", @_)));
+ }
+ elsif ($? & 127)
+ {
+ BAIL_OUT(
+ sprintf(
+ "command \"%s\" died with signal %d",
+ join(" ", @_),
+ $? & 127));
+ }
+ else
+ {
+ BAIL_OUT(
+ sprintf(
+ "command \"%s\" exited with value %d",
+ join(" ", @_),
+ $? >> 8));
+ }
}
- return;
}
=pod