sagat has asked for the wisdom of the Perl Monks concerning the following question:
I was going to do this....
As I suspected, even with sleep () between the print statements, the commands get run too quickly to be processed by the called command. In fact, it generally closes the filehandle before it even gets to run the "quit" piece, leaving the script hanging until I send it a SIGTERM. Setting $|=1 doesnt help either. Any suggestions?$|=1; $N_CONS = "/usr/bin/ncons"; open (CONS, "| $N_CONS"); sleep 5; print CONS "config execute test.cfg \n"; sleep 5; print CONS "config save \n"; sleep 5; print CONS "quit \n"; sleep 5; close (CONS);
-chris
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Interactive Input without Expect.pm
by dragonchild (Archbishop) on May 24, 2004 at 17:08 UTC | |
by sagat (Novice) on May 24, 2004 at 17:32 UTC | |
by dragonchild (Archbishop) on May 24, 2004 at 17:46 UTC | |
by PodMaster (Abbot) on May 24, 2004 at 18:29 UTC | |
|
Re: Interactive Input without Expect.pm
by perrin (Chancellor) on May 24, 2004 at 17:44 UTC | |
|
Re: Interactive Input without Expect.pm
by Fletch (Bishop) on May 24, 2004 at 17:49 UTC | |
by sagat (Novice) on May 24, 2004 at 18:13 UTC | |
|
Re: Interactive Input without Expect.pm
by Plankton (Vicar) on May 24, 2004 at 17:58 UTC | |
|
Re: Interactive Input without Expect.pm
by mifflin (Curate) on May 24, 2004 at 18:11 UTC | |
by Anonymous Monk on May 24, 2004 at 19:42 UTC |