mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
Avoid uninitialized value error in TAP tests' Cluster->psql
If the method is called in scalar context and we didn't pass in a stderr handle, one won't be created. However, some error paths assume that it exists, so in this case create a dummy stderr to avoid the resulting perl error. Per gripe from Oleg Tselebrovskiy <o.tselebrovskiy@postgrespro.ru> and adapted from his patch. Discussion: https://postgr.es/m/378eac5de4b8ecb5be7bcdf2db9d2c4d@postgrespro.ru
This commit is contained in:
@ -2199,6 +2199,14 @@ sub psql
|
|||||||
$ret = $?;
|
$ret = $?;
|
||||||
};
|
};
|
||||||
my $exc_save = $@;
|
my $exc_save = $@;
|
||||||
|
|
||||||
|
# we need a dummy $stderr from hereon, if we didn't collect it
|
||||||
|
if (! defined $stderr)
|
||||||
|
{
|
||||||
|
my $errtxt = "<not collected>";
|
||||||
|
$stderr = \$errtxt;
|
||||||
|
}
|
||||||
|
|
||||||
if ($exc_save)
|
if ($exc_save)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user