joschka has asked for the wisdom of the Perl Monks concerning the following question:
and this works perfectally well for me, the program terminates, the complete stdout is stored in that variable and my perl script moves on... But I thought to me..."hey all this commandline statement above is doing is forking a process and putting that newline character from the stdout from process 1 (parent) to stdin from the second process(child)". So I tried to reproduce this with fork but I cannot find the reason why this does not work. small snippet....my $parameter_output = `echo "\n" |programname -help`;
I also tried this with signals.... snippet:pipe (IN,OUT); my $pid = fork (); die("fork failed") if (!defined($pid)); if ($pid == 0 ) { #the child exec ('programname -help'); } else { #parent sleep (2); #printing the newline character in the child process print OUT "\n"; waitpid ($pid,0); }
neither this works.... I think somewhere I have a big error in reasoning I think. So it would be very kind if someone could help me. Thanks in advance joshisub print_it {print "\n"}; my $SIG{INT}=\&print_it; .... else { #parent sleep (2); kill INT=>$pid; waitpid ($pid,0); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Trying to pass a "press any key" program in terminal.
by moritz (Cardinal) on Jan 21, 2008 at 21:48 UTC | |
by joschka (Initiate) on Jan 21, 2008 at 23:11 UTC | |
|
Re: Trying to pass a "press any key" program in terminal.
by kyle (Abbot) on Jan 21, 2008 at 21:52 UTC |