[Cuis-dev] OSProcess process exit codes (was: DSL GUI framework)

David T. Lewis lewis at mail.msen.com
Fri Oct 15 17:08:55 PDT 2021

Hi Nicola,

On Fri, Oct 15, 2021 at 02:06:26PM +0200, Nicola Mingotti via Cuis-dev wrote:
> Hi David,
> Thank you for pointing this out, it is a nice example !
> I use PipeableOSProcess quite frequently, every time there isn't a specific
> library and i must offload a task to Ruby or Python, or just call shell 
> command.

OSProcess class>>outputOf: is a convenience method that you may find
helpful for this kind of work. It handles any command pipeline errors
in a debugger before answering the full output of the command pipeline.

> I have found only one little thing that is not working as expected,
> it is about exit codes, I don't have an example at hand now, but
> I will be back on this subject.

The exit status of an ExternalUnixOSProcess is the result of a system
call to waitpid() after the process exits. This gives an integer exit
status, but it is different from the exit status that is reported by a
Unix shell. Basically, if you take the actual exit status from waitpid()
and shift right 8 bits, you get the status number that you would expect
to see in a shell (the $? exit status variable in bash).

For any Unix/Linux system, you can reliably assume that an exit status
of 0 means success, regardless of the specific encoding of the waitpid()


More information about the Cuis-dev mailing list