Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Control not coming back to perl script

by Tanktalus (Canon)
on Mar 03, 2016 at 14:49 UTC ( [id://1156730]=note: print w/replies, xml ) Need Help??


in reply to Control not coming back to perl script

I'm confused as to what you're trying to accomplish here. You want the output of this command (which means waiting until the output is closed) or to run in the background? You can't do both - at least not with qx. If you want the application to run in the background while you continue, you will, by definition, not get any lines back immediately. You can do this with proper threading or event handling, but you're still not going to get lines immediately. I'm not even sure that you really want the lines, but you're specifically asking for it, so I'm assuming there's a reason why you're using qx instead of system.

Further, I'm confused by those quotes inside the qx. That doesn't make any sense to me whatsoever. If the open double-quote was after the -i, that'd make more sense.

Another option, if you don't need the output, is to use system(1, $cmd) - on Windows, that should start the command in the background, though it'll leave the connection open.

I'd suggest using nohup and redirecting output (the latter which salva suggested). And maybe look into whether plink has some of the ssh options that force its connection into the background.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1156730]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-25 19:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found