exit code of a command executed by rexec

I'm executing a command on SCO Open SERVER 5 with the following call:
soc = rexec(&hoststr, (u_short)service_entry->s_port, user, passwd, cmd, &fd2p);
I can read the stdout of the command from the socket soc, and I can read the stderr of the command from the socket fd2p.
How can I get the exit code of the command?
wiggershausAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
mliberiConnect With a Mentor Commented:
The only way is to get it from stdout or stderr.

Instead of running "cmd", run the command "sh -c 'cmd;echo $?'" or "sh -c 'cmd;echo $?'>&2" and get the rc from the last line of stdout or stderr respectively.
0
All Courses

From novice to tech pro — start learning today.