[fpc-pascal] TProcess execution
jonas.maebe at elis.ugent.be
Thu Feb 9 08:42:21 CET 2006
On 9 feb 2006, at 07:48, Micha Nelissen wrote:
>>> How can I know whether a TProcess failed when trying to execute it ?
>>> Running will be false, but I want to distinguish between the file
>>> there / no execution permission / etc. and it started running but
>>> was done
>> It should raise an exception if execution fails ?
> That I should have noticed :-). In unix, the return result of the
> 'fpexecve' call is not checked, at least. If it returns, it does
> 'halt(127)', so should I check the ExitStatus being 127 ?
Yes. If you look at things like "man popen" under Linux (or pretty
much any *nix), you'll also see comments like this:
Failure to execute the shell is indistinguishable from
failure to execute command, or an immediate exit of the
only hint is an exit status of 127.
The reason is that because of the fork/vfork construct these OS'es
use, there is no way to report an error to the parent process except
by exit codes.
More information about the fpc-pascal