in reply to Re^3: Read Pipe, Never Enters While Loop
in thread Read Pipe, Never Enters While Loop

I added the code to die if open failed, and it doesn't die. Looks to me like open is working?

open (PRM, "-|", $NE_obj->cmd("ssh $activepilotrcs reboot ; tailer PRM +")) or die "Could not open PRM: $!\n";; while (<PRM>) { print "DEBUG: $_\n"; if ($_ =~ m/.*FAILED HEARTBEAT.*/sxi) { print "$spacer $spacer $spacer $spacer Alarm Received That Act +ive Pilot Has Gone Down...\n"; } elsif ($_ =~ m/.*STARTING OA&M LEAD TRANSITION.*/sxi) { print "$spacer $spacer $spacer $spacer Standby Pilot $stdbypil +otrcs Has Started Transitioning To Active...\n"; } elsif ($_ =~ m/.*FAILOVER INITIALIZATION COMPLETED.*/sxi) { print "$spacer $spacer $spacer $spacer Standby Pilot $stdbypil +otrsc Has Transitioned To Active...\n"; $NE_output = $NE_obj->cmd("\003"); last; } else { next; } }

Replies are listed 'Best First'.
Re^5: Read Pipe, Never Enters While Loop
by ImJustAFriend (Scribe) on Jun 05, 2017 at 13:54 UTC

    Never mind, I changed the code to just tail a file and a foreach loop to print the lines read by tail... and got back a "File not found" message...