Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capturing die output

Status
Not open for further replies.

jerehart

Programmer
Jun 10, 1999
61
0
0
US
I am having trouble capturing 'die' output. I have a script which calls another script on a different machine. If there is an error on the target machine's script it dies. I use a 'rsh' to call the target script but I can only capture print statements if I do:

$TARGET = `rsh target:/home/bin/Script.pl`;

The die statement will output to the screen, but I cannot read it to fork. I can also not change the target script.

Any ideas?

 
The statements 'die' and 'warn' will output to 'stderr' and not to 'stdout'. You must redirect 'stderr' to your rsh.
 
try

$TARGET = `rsh 'target:/home/bin/Script.pl 2>&1'`;

Mike
michael.j.lacey@ntlworld.com
 
Can't you also use the reserved variable $! to do this. Like when you open a text file and you want to catch the error message, or is this something totally different?

-Vic

vic cherubini
malice365@hotmail.com
====

Knows: Perl, HTML, JavScript, C/C++, PHP, Flash, Director

Wants to Know: Java, Cold Fusion, Tcl/TK

====
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top