Re: Add SHELL_EXIT_CODE to psql
От | Tom Lane |
---|---|
Тема | Re: Add SHELL_EXIT_CODE to psql |
Дата | |
Msg-id | 1001466.1678481354@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Add SHELL_EXIT_CODE to psql (Justin Pryzby <pryzby@telsasoft.com>) |
Ответы |
Re: Add SHELL_EXIT_CODE to psql
|
Список | pgsql-hackers |
Justin Pryzby <pryzby@telsasoft.com> writes: > The exit status is one byte. I think you should define the status > variable along the lines of: > - 0 if successful; or, > - a positive number 1..255 indicating its exit status. or, > - a negative number N indicating it was terminated by signal -N; or, > - 256 if an internal error occurred (like pclose/ferror); > See bash(1). This would be a good behavior to start with, since it > ought to be familiar to everyone, and if it's good enough to write/run > shell scripts in, then it's got to be good enough for psql to run a > single command in. I'm okay with adopting bash's rule, but then it should actually match bash --- signal N is reported as 128+N, not -N. Not sure what to do about pclose/ferror cases. Maybe use -1? > I'm not sure why the shell uses 126-127 specially, though.. 127 is used similarly by system(3). I think both 126 and 127 might be specified by POSIX, but not sure. In any case, those are outside our jurisdiction. regards, tom lane
В списке pgsql-hackers по дате отправления: