Add SHELL_ERROR and SHELL_EXIT_CODE magic variables to psql.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 21 Mar 2023 17:03:42 +0000 (13:03 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 21 Mar 2023 17:03:56 +0000 (13:03 -0400)
commitb0d8f2d983cb25d1035fae1cd7de214dd67809b4
tree765a0ea3579a960f3574a38e229338011b804e3a
parent0f85db92b9ea167d3b9e90f3fb5fb3b9a93babc2
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
doc/src/sgml/ref/psql-ref.sgml
src/bin/psql/command.c
src/bin/psql/help.c
src/bin/psql/psqlscanslash.l
src/common/wait_error.c
src/include/port.h