That's
what we're doing. As I said, it's only sporadically that these commands
don't return STDOUT. For the most part, they work, but sometimes we have
problems. One way that we've worked around the STDOUT problem is by
redirecting STDOUT to a file and then reading back the file, but that shouldn't
be necessary. I've stepped through the code and run the command directly
on the host when I see the problem occur in our script to see if it's something
odd happening on the system itself, but no luck there.
-----Original Message-----Donn't know about return code ...
From: Dragos CIULICA [mailto:[EMAIL PROTECTED]
Sent: Friday, August 20, 2004 9:54 AM
To: vega, james
Cc: '[EMAIL PROTECTED]'
Subject: RE: [Perl-unix-users] Odd problems from shell commands run via RP C service
Have you tried:
my $command_output = `some_system_command_here`; #look carefully here ... it is <<`>>, not <<'>>
print "output:\n" . $command_output;
Good Luck,
Dragos CIULICA.
On Fri, 2004-08-20 at 16:33, vega, james wrote:> -----Original Message----- > From: Anthony Ettinger [mailto:[EMAIL PROTECTED] > > I don't know about RPC, but I usually use this syntax > when calling an external command: > > system($cmd) == 0 or die "system @args failed: $?" > > perldoc -f system Thanks for the reply, but I'm afraid that doesn't address my problem. We need to capture the output from the command as well as be able to access the return code. system() just returns the return code, hence why I said we are using backticks. Sorry if my first explanation wasn't clear about that. > > --- "vega, james" <[EMAIL PROTECTED]> wrote: > > > I'm having a couple interesting issues with > > backticked commands performed > > via RPC[1] calls to another host. The first problem > > is that we will > > sporadically not get back the STDOUT from the > > process. The second problem > > is that, after a certain point, we will stop getting > > back proper return > > codes. It will just return -1. This seems to occur > > after we've fork()ed > > and then called a Perl script from within the fork > > (problems with reentrant > > libraries?). Both of these have occurred with Perl > > 5.8.x. These problems > > have been seen on HPUX, AIX, and Suse. This has > > never occurred on any of > > the Windows hosts that I've used. Thanks in advance > > for any help. This has > > been a real mind boggler. > > > > James > > > > [1]. The RPC service I'm using is the example > > service given in Chapter 13 of > > Advanced Perl Programming. _______________________________________________ Perl-Unix-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________ Perl-Unix-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs