Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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

by edimusrex (Monk)
on Sep 08, 2016 at 16:15 UTC ( #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
  • Comment on Re^2: Capturing bash output without displaying STOUT in terminal

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 (Pope) 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? | Other CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2021-09-28 18:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?