|
25 | 25 |
|
26 | 26 | local%ENV =$node->_get_env();
|
27 | 27 |
|
| 28 | +my ($stdin,$stdout,$stderr); |
| 29 | + |
| 30 | +# Test whether shell supports $PPID. It's part of POSIX, but some |
| 31 | +# pre-/non-POSIX shells don't support it (e.g., NetBSD, Solaris). |
| 32 | +$stdin ="\\! echo\$PPID"; |
| 33 | +IPC::Run::run(['psql','-X','-v','ON_ERROR_STOP=1'],'<', \$stdin,'>', \$stdout,'2>', \$stderr); |
| 34 | +$stdout =~/^\d+$/or skip"shell apparently does not support\$PPID", 2; |
| 35 | + |
28 | 36 | local$SIG{ALRM} =sub {
|
29 | 37 | my$psql_pid = TestLib::slurp_file("$tempdir/psql.pid");
|
30 | 38 | kill'INT',$psql_pid;
|
31 | 39 | };
|
32 | 40 | alarm 1;
|
33 | 41 |
|
34 |
| -my$stdin ="\\! echo\$PPID >$tempdir/psql.pid\nselect pg_sleep(3);"; |
35 |
| -my ($stdout,$stderr); |
| 42 | +$stdin ="\\! echo\$PPID >$tempdir/psql.pid\nselect pg_sleep(3);"; |
36 | 43 | my$result = IPC::Run::run(['psql','-X','-v','ON_ERROR_STOP=1'],'<', \$stdin,'>', \$stdout,'2>', \$stderr);
|
37 | 44 |
|
38 | 45 | ok(!$result,'query failed as expected');
|
|