Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc818c25

Browse files
committed
psql: Improve portability of query cancel test
Some shells apparently don't support $PPID, so skip the test in thatcase.
1 parent945f395 commitc818c25

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

‎src/bin/psql/t/020_cancel.pl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,21 @@
2525

2626
local%ENV =$node->_get_env();
2727

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+
2836
local$SIG{ALRM} =sub {
2937
my$psql_pid = TestLib::slurp_file("$tempdir/psql.pid");
3038
kill'INT',$psql_pid;
3139
};
3240
alarm 1;
3341

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);";
3643
my$result = IPC::Run::run(['psql','-X','-v','ON_ERROR_STOP=1'],'<', \$stdin,'>', \$stdout,'2>', \$stderr);
3744

3845
ok(!$result,'query failed as expected');

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp