Solved

exit code of a command executed by rexec

Posted on 1999-01-27
1
220 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 200 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

770 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