UPDATE: Less Code!
Here's the code:
, which works reasonably well. However, if, in the run() command, I turn the '2>' into '2>pty>', I get nothing to STDERR. How can I make the program think both are attached via different ttys? Or, will that even make a difference?#!/opt/local/bin/perl -w use IPC::Run; use strict; $workdir="/fma/prod1/isa/logs"; $logfile="$workdir/test.log"; open(LOG,">$logfile") || die "Error: Could not open $logfile: $!\n"; print "*-*-begin_run-*-*\n"; chdir("$dir"); @cmd=$ARGV[0]; { run (\@cmd, '>pty>', sub{ print "$_[0]";}, '2>', sub { chomp $_[0]; +print "<b>$_[0]</b>\n";}) or die("Error executing child. Child return +ed $&\n"); } print "*-*-end_run-*-*\n"; close(LOG);
_________________________________________________________________________________
Without me, it's just aweso
In reply to How to use pty for both STDERR AND STDOUT in IPC::Run, while doing something different with each? by OfficeLinebacker
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |