mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Add SHELL_ERROR and SHELL_EXIT_CODE magic variables to psql.
These are set after a \! command or a backtick substitution. SHELL_ERROR is just "true" for error (nonzero exit status) or "false" for success, while SHELL_EXIT_CODE records the actual exit status following standard shell/system(3) conventions. Corey Huinker, reviewed by Maxim Orlov and myself Discussion: https://postgr.es/m/CADkLM=cWao2x2f+UDw15W1JkVFr_bsxfstw=NGea7r9m4j-7rQ@mail.gmail.com
This commit is contained in:
@ -4267,6 +4267,34 @@ bar
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="app-psql-variables-shell-error">
|
||||
<term><varname>SHELL_ERROR</varname></term>
|
||||
<listitem>
|
||||
<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.
|
||||
See also <varname>SHELL_EXIT_CODE</varname>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="app-psql-variables-shell-exit-code">
|
||||
<term><varname>SHELL_EXIT_CODE</varname></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The exit status returned by the last shell command.
|
||||
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.
|
||||
See also <varname>SHELL_ERROR</varname>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="app-psql-variables-show-all-results">
|
||||
<term><varname>SHOW_ALL_RESULTS</varname></term>
|
||||
<listitem>
|
||||
|
Reference in New Issue
Block a user