Solved

exit code of a command executed by rexec

Posted on 1999-01-27
1
228 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Database Solutions Engineer FAQs

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller single-server environments.

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.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses

622 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