Re: Add SHELL_EXIT_CODE to psql - Mailing list pgsql-hackers

From Maxim Orlov
Subject Re: Add SHELL_EXIT_CODE to psql
Date
Msg-id CACG=ezY7=dik8PcjA9kaLRgg=zo2bgA9Q5t6k4TQGi6tQWn5AQ@mail.gmail.com
Whole thread Raw
In response to Re: Add SHELL_EXIT_CODE to psql  (Corey Huinker <corey.huinker@gmail.com>)
Responses Re: Add SHELL_EXIT_CODE to psql
List pgsql-hackers
On Mon, 30 Jan 2023 at 23:23, Corey Huinker <corey.huinker@gmail.com> wrote:


I rebased, but there are no code differences.
 
The patch set seem to be in a good shape and pretty stable for quite a while.
Could you add one more minor improvement, a new line after variables declaration?

+               int             exit_code = wait_result_to_exit_code(result);
+               char    buf[32];
...here
+               snprintf(buf, sizeof(buf), "%d", exit_code);
+               SetVariable(pset.vars, "SHELL_EXIT_CODE", buf);
+               SetVariable(pset.vars, "SHELL_ERROR", "true");

+               char    exit_code_buf[32];
... and here
+               snprintf(exit_code_buf, sizeof(exit_code_buf), "%d",
+                                wait_result_to_exit_code(exit_code));
+               SetVariable(pset.vars, "SHELL_EXIT_CODE", exit_code_buf);
+               SetVariable(pset.vars, "SHELL_ERROR", "true");
 
After this changes, I think, we make this patch RfC, shall we?

--
Best regards,
Maxim Orlov.

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: LWLock deadlock in brinRevmapDesummarizeRange
Next
From: Alvaro Herrera
Date:
Subject: Re: pgindent vs. git whitespace check