Add SHELL_ERROR and SHELL_EXIT_CODE magic variables to psql.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: b0d8f2d983cb25d1035fae1cd7de214dd67809b4
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2023-03-21T17:03:56Z
Releases: 16.0
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

Files

PathChange+/−
doc/src/sgml/ref/psql-ref.sgml modified +28 −0
src/bin/psql/command.c modified +15 −0
src/bin/psql/help.c modified +4 −0
src/bin/psql/psqlscanslash.l modified +21 −3
src/common/wait_error.c modified +19 −0
src/include/port.h modified +1 −0

Documentation touched

Discussion