Justin Pryzby <pry...@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