mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
psql: set SHELL_ERROR and SHELL_EXIT_CODE in more places.
Make the \g, \o, \w, and \copy commands set these variables
when closing a pipe. We missed doing this in commit b0d8f2d98
,
but it seems like a good idea.
There are some remaining places in psql that intentionally don't
update these variables after running a child program:
* pager invocations
* backtick evaluation within a prompt
* \e (edit query buffer)
Corey Huinker and Tom Lane
Discussion: https://postgr.es/m/CADkLM=eSKwRGF-rnRqhtBORRtL49QsjcVUCa-kLxKTqxypsakw@mail.gmail.com
This commit is contained in:
@ -4277,8 +4277,12 @@ bar
|
||||
<para>
|
||||
<literal>true</literal> if the last shell command
|
||||
failed, <literal>false</literal> if it succeeded.
|
||||
This applies to shell commands invoked via the <literal>\!</literal>
|
||||
meta-command or backquote (<literal>`</literal>) expansion.
|
||||
This applies to shell commands invoked via the <literal>\!</literal>,
|
||||
<literal>\g</literal>, <literal>\o</literal>, <literal>\w</literal>,
|
||||
and <literal>\copy</literal> meta-commands, as well as backquote
|
||||
(<literal>`</literal>) expansion. Note that
|
||||
for <literal>\o</literal>, this variable is updated when the output
|
||||
pipe is closed by the next <literal>\o</literal> command.
|
||||
See also <varname>SHELL_EXIT_CODE</varname>.
|
||||
</para>
|
||||
</listitem>
|
||||
@ -4292,8 +4296,12 @@ bar
|
||||
0–127 represent program exit codes, 128–255
|
||||
indicate termination by a signal, and -1 indicates failure
|
||||
to launch a program or to collect its exit status.
|
||||
This applies to shell commands invoked via the <literal>\!</literal>
|
||||
meta-command or backquote (<literal>`</literal>) expansion.
|
||||
This applies to shell commands invoked via the <literal>\!</literal>,
|
||||
<literal>\g</literal>, <literal>\o</literal>, <literal>\w</literal>,
|
||||
and <literal>\copy</literal> meta-commands, as well as backquote
|
||||
(<literal>`</literal>) expansion. Note that
|
||||
for <literal>\o</literal>, this variable is updated when the output
|
||||
pipe is closed by the next <literal>\o</literal> command.
|
||||
See also <varname>SHELL_ERROR</varname>.
|
||||
</para>
|
||||
</listitem>
|
||||
|
Reference in New Issue
Block a user