Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Capturing bash output without displaying STOUT in terminal

by edimusrex (Monk)
on Sep 08, 2016 at 16:15 UTC ( [id://1171412]=note: print w/replies, xml ) Need Help??


in reply to Re: Capturing bash output without displaying STOUT in terminal
in thread Capturing bash output without displaying STOUT in terminal

Yea, I am looking into Capture::Tiny right now, the output of this command still doesn't seem to want to be captured, I will play around with it some

Replies are listed 'Best First'.
Re^3: Capturing bash output without displaying STOUT in terminal
by dasgar (Priest) on Sep 08, 2016 at 16:29 UTC

    Based on your response to my post as well as stevieb's initial post, I'd agree with stevieb that it looks like the command that you're running is sending the response to STDERR. As stevieb has pointed out, his suggestion of using backticks will only let you capture STDOUT. Capture::Tiny can capture both STDOUT and STDERR (and exit code) for system commands.

      Or, you can append 2>&1 to the command line, allowing STDERR to be captured through STDOUT. Only recommended if the normal STDOUT is empty.
Re^3: Capturing bash output without displaying STOUT in terminal
by ikegami (Patriarch) on Sep 08, 2016 at 21:36 UTC

    Some programs (e.g ssh when asking for a password) write directly to the terminal, not STDOUT.

    $ ssh ikegami@209.197.123.153 2>&1 >/dev/null ikegami@209.197.123.153's password:

    You have to create pseudo-tty's (as Expect does) in that case.


    IPC::Run supports capturing STDOUT and STDERR separately, and easily. It even supports pseudo-tty creation if you need them.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-03-29 01:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found