From: | Corey Huinker <corey(dot)huinker(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Justin Pryzby <pryzby(at)telsasoft(dot)com>, Maxim Orlov <orlovmg(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Add SHELL_EXIT_CODE to psql |
Date: | 2023-03-17 21:05:20 |
Message-ID: | CADkLM=fQBS=xEt7ZTMi3HRfaiFZdHDWKc3EJCp1V9St3vtm+5g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Mar 10, 2023 at 3:49 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I'm okay with adopting bash's rule, but then it should actually match
> bash --- signal N is reported as 128+N, not -N.
>
128+N is implemented.
Nonzero pclose errors of any kind will now overwrite an existing exit_code.
I didn't write a formal test for the signals, but instead tested it
manually:
[310444:16:54:32 EDT] corey=# \! sleep 1000
-- in another window, i found the pid of the sleep command and did a kill
-9 on it
[310444:16:55:15 EDT] corey=# \echo :SHELL_EXIT_CODE
137
137 = 128+9, so that checks out.
The OS-specific regression test has been modified. On Windows systems it
attempts to execute "CON", and on other systems it attempts to execute "/".
These are marginally better than "nosuchcommand" in that they should always
exist on their host OS and could never be a legit executable. I have no
opinion whether the test should live on past the development phase, but if
it does not then the 0001 patch is not needed.
Attachment | Content-Type | Size |
---|---|---|
v9-0001-Add-PG_OS_TARGET-environment-variable-to-enable-O.patch | text/x-patch | 1.1 KB |
v9-0002-Add-wait_result_to_exit_code.patch | text/x-patch | 1.6 KB |
v9-0003-Add-psql-variables-SHELL_ERROR-and-SHELL_EXIT_COD.patch | text/x-patch | 7.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tomas Vondra | 2023-03-17 21:43:37 | Re: logical decoding and replication of sequences, take 2 |
Previous Message | Pavel Stehule | 2023-03-17 20:50:09 | Re: Schema variables - new implementation for Postgres 15 |