in reply to Re^2: Perl open pipe exiting early
in thread Perl open pipe exiting early

No luck with this, ubless I messed up the way I added it:
my $run_pid = open(RUN, "sub_script.pl $options 2>&1 |") or $sub_fai +led = 1; if (!$sub_failed) { $text .= "Entered if (!\$sub_failed) {\n"; while (<RUN>) { $text .= "Entered while (<RUN>)\n"; chomp; $_ =~ s/^\s*//; $text .= "$_\n"; } close(RUN); if ($? != 0) { $sub_failed = 1; $text = "Open error: $!\n";} } else { $text .= "Failed to open sub_script.pl\n";} print "$text";
$! returned empty. I could well be using it incorrectly though.

Replies are listed 'Best First'.
Re^4: Perl open pipe exiting early
by choroba (Cardinal) on Apr 03, 2015 at 13:44 UTC
    Calling close changes $!. Store its value immediately after the failed open.
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
      Okay, trying this now.
Re^4: Perl open pipe exiting early
by RichardK (Parson) on Apr 03, 2015 at 13:50 UTC
      I would if I could reproduce the issue! :) The issue is intermittent. I have several hundred users running the script thousands of times a day. I get a mail when there is an issue....and different users see it at different times. A user could run the script, see the issue, rerun it immediately and not see the issue.