Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
now, this will work, BUT in the case that one of these commands causes the program im talking to to suddenly die, it will keep pump()ing because it will never get the next prompt ("BRU Server >")...how can i tell it to wait for that prompt OR until the program dies?# start the ipc $h = start \@cmd, \$in, \$out ; # send login info, keep reading until shell prompt $in = "$password\n" ; pump $h until $out =~ /BRU Server >/i ; # do what we need to do $in = "backup -some -params\n" ; pump $h until $out =~ /BRU Server >/i ; print "Output:\n$output"; # and, we're done here $in = "exit\n" ; pump $h while length $in; finish $h or die "oh crap: $?";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: IPC::Run and start(); pump(); finish()
by kwaping (Priest) on Nov 10, 2005 at 18:46 UTC | |
|
Re: IPC::Run and start(); pump(); finish()
by BrowserUk (Patriarch) on Nov 10, 2005 at 19:04 UTC | |
by Anonymous Monk on Nov 10, 2005 at 20:58 UTC | |
by BrowserUk (Patriarch) on Nov 10, 2005 at 21:43 UTC | |
|
Re: IPC::Run and start(); pump(); finish()
by Anonymous Monk on Nov 14, 2005 at 16:45 UTC | |
by BrowserUk (Patriarch) on Nov 14, 2005 at 17:27 UTC |