Jump to content
Sign in to follow this  
Socket1

Run() Waiting until window is closed

Recommended Posts

Socket1

I'm using $handle = Run("command", "", @SW_HIDE, $STDOUT_CHILD)

and then after it a sleep of 2 seconds and then code that reads the content of the command's stdout

The command happens to be a putty/plink ssh window but it does not work the way its expected

if I change @SW_HIDE to @SW_MAXIMIZED the command window shows up and only when I close it does the

code to start reading the data come in.

The documentation for the Run command says that "After running the requested program the script continues. To pause execution of the script until the spawned program has finished use the RunWait function instead."

So what is going on?

I've also tried @ComSpec & " /c command" and it still produces the same results.

I can tell the SSH session is opened by the command because the logs show so so there should be at least the login message in the stdout buffer.

Edited by Socket1

Share this post


Link to post
Share on other sites
TurionAltec

I don't think putty writes to stdout.

Share this post


Link to post
Share on other sites
mojomatt

There is a known bug with PLINK.EXE. Adding the STDIN_CHILD opt flag in the RUN statement fixed this for me.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.