Jump to content
Sign in to follow this  
rbabcock

Redirect stdio and get return code

Recommended Posts

rbabcock

If I use the Run command, I can redirect the 3 stdio handles.

If I use the RunWait command, I can get the exit code of the program I run.

Is there a way to do both at the same time? Thanks.

Share this post


Link to post
Share on other sites
MHz

Sure is. Already have some UDFs created to handle returning the exitcode from Run() located here.

:)

Share this post


Link to post
Share on other sites
rbabcock

Thanks, looks like just what I need. I'll try it out Monday (this is for a work task).

Share this post


Link to post
Share on other sites
rbabcock

I noticed that $h_Process is not declared in _ProcessOpenHandle which triggers an error if you use AutoItSetOption("MustDeclareVars", 1). I'm also confused by what this function returns. On error, it returns "Not SetError(1)", but the AutoIt help file says that SetError returns nothing unless the 3rd parameter is set. It's also not obvious from the comments that the handle returned on success is an array.

I also worried about what would happen if the program finished before the call to _ProcessOpenHandle, but after inserting time delays to make sure this happened, nothing broke.

Anyway, it does seem to be working for me. Thanks again.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×