[fpc-pascal]Exit codes of called programs.

A.J. Venter ajventer at direqlearn.org
Wed Apr 16 15:28:37 CEST 2003


On Wed, 2003-04-16 at 13:31, Jonas Maebe wrote:
> On dinsdag, apr 15, 2003, at 10:50 Europe/Brussels, A.J. Venter wrote:
> 
> > I often write frontends for commandline programs.
> > When I need their output, I call assignstream, when I don't I use 
> > shell.
> >
> > What I would like however, is a way to check the exit codes of such
> > programs, so that I can for example tell if a program failed to run
> > correctly.
> 
> If you use shell, you can only get the exit code of the shell (since 
> that is the program that your program started). If you use Dos.exec(), 
> use the DosExitCode() function afterwards. AssignStream doesn't seem to 
> be able to return exit codes.

OK so shell is out, after all I am not all that concerned with how bash
exited. Assignstream as well. I did not even know that dos exec could
work under Linux, I somehow seem to think this is a less than adequate
approach though.

How do C programmers do it under Linux ? I am sure it must be possible
to use the same technique.

A.J.
-- 
Story of my life: "Semper in excretum, set alta variant"
A.J. Venter
DireqLearn Linux Guru




More information about the fpc-pascal mailing list