]> granicus.if.org Git - postgresql/commitdiff
Fix timeouts in PostgresNode::psql
authorPeter Eisentraut <peter_e@gmx.net>
Wed, 1 Mar 2017 18:52:38 +0000 (13:52 -0500)
committerPeter Eisentraut <peter_e@gmx.net>
Wed, 1 Mar 2017 19:02:06 +0000 (14:02 -0500)
Newer Perl or IPC::Run versions default to appending the filename to string
exceptions, e.g. the exception

    psql timed out

 is thrown as

    psql timed out at /usr/share/perl5/vendor_perl/IPC/Run.pm line 2961.

To handle this, match exceptions with !~ rather than ne.

From: Craig Ringer <craig@2ndquadrant.com>
Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
src/test/perl/PostgresNode.pm

index 9b712ebf3069ae2fce0a61a51c9fd14e1ab0ef75..bd627b29deea9c0692fe1db993b9cd5f0fbe424a 100644 (file)
@@ -1116,7 +1116,7 @@ sub psql
                        # IPC::Run::run threw an exception. re-throw unless it's a
                        # timeout, which we'll handle by testing is_expired
                        die $exc_save
-                         if (blessed($exc_save) || $exc_save ne $timeout_exception);
+                         if (blessed($exc_save) || $exc_save !~ /^\Q$timeout_exception\E/);
 
                        $ret = undef;