Re: Add SHELL_EXIT_CODE to psql

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Add SHELL_EXIT_CODE to psql
Дата
Msg-id 2121526.1677782127@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Add SHELL_EXIT_CODE to psql  (Corey Huinker <corey.huinker@gmail.com>)
Ответы Re: Add SHELL_EXIT_CODE to psql  (Corey Huinker <corey.huinker@gmail.com>)
Список pgsql-hackers
Corey Huinker <corey.huinker@gmail.com> writes:
> [ v9-0003-Add-psql-variables-SHELL_ERROR-and-SHELL_EXIT_COD.patch ]

I took a brief look through this.  I'm on board with the general
concept, but I think you've spent too much time on an ultimately
futile attempt to get a committable test case, and not enough time
on making the behavior correct/usable.  In particular, it bothers
me that there doesn't appear to be any way to distinguish whether
a command failed on nonzero exit code versus a signal.  Also,
I see that you're willing to report whatever ferror returns
(something quite unspecified in relevant standards, beyond
zero/nonzero) as an equally-non-distinguishable integer.

I'm tempted to suggest that we ought to be returning a string,
along the lines of "OK" or "exit code N" or "signal N" or
"I/O error".  This though brings up the question of exactly
what you expect scripts to use the variable for.  Maybe such
a definition would be unhelpful, but if so why?  Maybe we
should content ourselves with adding the SHELL_ERROR boolean, and
leave the details to whatever we print in the error message?

As for the test case, I'm unimpressed with it because it's so
weak as to be nearly useless; plus it seems like a potential
security issue (what if "nosuchcommand" exists?).  It's fine
to have it during development, I guess, but I'm inclined to
leave it out of the eventual commit.

            regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Ankit Kumar Pandey
Дата:
Сообщение: Re: Sort optimizations: Making in-memory sort cache-aware
Следующее
От: Justin Pryzby
Дата:
Сообщение: Re: Operation log for major operations