Results 1 to 2 of 2
I'm having a program which I'll call C here starting another program which I'll call P here. I do it through having C fork()ing off a child who calls execlp() ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 09-09-2005 #1
- Join Date
- Sep 2005
Problems with execlp
I'm having a program which I'll call C here starting another program which I'll call P here. I do it through having C fork()ing off a child who calls execlp() to start P. And I am interested in the exit code of the program P I'm starting. However, execlp() does not fail to start the other program P and hence execlp() returns nothing. I'm interested in various ways to get hold of that exit code of P and wait() (and waitX()) does not do it so I have been thinking of writing a bash-wrapper, basically a bash-script that gets called by C and which, in its turn, starts P, checks what P returns and then sends a signal to the caller C depending on the exit code of P, however, this involved sending the process ID of the caller C to the wrapper and having the wrapper send a signal back to the caller C and having a signal handler in the caller C and churn churn churn... I'm thinking perhaps there is a better way.
- 09-09-2005 #2
- Join Date
- Oct 2004
What's wrong in using wait()?
Did you read the man page of wait() (man 2 wait)?
This is the standard way in UNIX to get the return status of the child process.
In fact, even the shell is going to do the same thing.The Unforgiven
Registered Linux User #358564