Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: qx not always capturing stdout

by StuLong (Acolyte)
on Mar 23, 2016 at 21:20 UTC ( #1158654=note: print w/replies, xml ) Need Help??


in reply to Re: qx not always capturing stdout
in thread qx not always capturing stdout

No change, same output. Or rather lack thereof.

Replies are listed 'Best First'.
Re^3: qx not always capturing stdout
by FreeBeerReekingMonk (Deacon) on Mar 24, 2016 at 00:26 UTC
    Found an example, where the daemonization closes STDOUT and STDIN in order to not create files. This could confuse the child process (which has no stdout). So either, maybe this works:

    use Daemon::Simple; open(SAVEIN, "<&STDIN"); open(SAVEOUT, "<&STDOUT"); Daemon::Simple::init("daemon"); open(STDIN, "<&SAVEIN"); open(STDOUT, "<&SAVEOUT"); print qx("/external/command"); close(STDIN); close(STDOUT);

    or you will have to redirect your output to a file

    qx("/external/command > /tmp/file")

    and read it back using open(), diamond and close()

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2022-08-14 06:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?