Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

exit code of a command executed by rexec

Posted on 1999-01-27
1
Medium Priority
?
232 Views
Last Modified: 2013-12-26
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?
0
Comment
Question by:wiggershaus
1 Comment
 
LVL 3

Accepted Solution

by:
mliberi earned 600 total points
ID: 1296412
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

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question