Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: capture STDOUT when some jerk opened STDOUT to /dev/tty

by salva (Abbot)
on Jan 07, 2013 at 21:09 UTC ( #1012110=note: print w/replies, xml ) Need Help??

in reply to capture STDOUT when some jerk opened STDOUT to /dev/tty

You can use screen(1) to capture the output sent to /dev/tty easily. For instance:
$ screen -L ssh

Replies are listed 'Best First'.
Re^2: capture STDOUT when some jerk opened STDOUT to /dev/tty
by Tommy (Chaplain) on Jan 07, 2013 at 21:47 UTC

    Sure, rub it in that we don't get to have screen at $work ;_;

    You know I even tried ssh 0 cmd!! Using screen is a really cool idea though.

    Originally I was just wondering if there was an obvious Perl solution to the problem that I was just either overlooking or of which I was unaware.

    "Perl follows the principle of least astonishment"
      Well, you can write your own tty logger using IO::Pty. It shouldn't be too complex.

      Another option may be to run the program through strace logging the interesting events. Then post-process that information to obtain a clean log of the data written to /dev/tty

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1012110]
[Lady_Aleena]: Good guh! I think I will use File::Find when working in perl. That is too many toothpicks.
[marioroy]: mp3info must be in the PATH
[marioroy]: LA ++
[Lady_Aleena]: marioroy, this is forcing me to learn perl modules to use instead.
[marioroy]: qx isn't fun if having to backslash ' and " and \.
[marioroy]: LA ++ ok.
[marioroy]: I wrote a mp3info script to see the arguments received with print "@ARGV\n";
[marioroy]: And compared with running find on the command line.
[marioroy]: Bye all.
[Lady_Aleena]: marioroy, bye.

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2017-04-23 21:32 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (432 votes). Check out past polls.