too hasty post:
i've been messing around in your code and this seems to work:
and i used this as the fill.pl:use Socket; use IO::Handle; use POSIX ":sys_wait_h"; my $childPid; socketpair(CHILD, PARENT, AF_UNIX, SOCK_STREAM, PF_UNSPEC); CHILD->autoflush(1); PARENT->autoflush(1); die "no child fork" unless defined($childPid=fork()); if ($childPid){ shutdown(PARENT,0); print "about to read\n"; while (<CHILD>){ last if (/Are you ready\? > /); print "got $_"; } print PARENT "yes\n"; print "we're ready\n"; } else { print "waiting for pid..\n"; } open(STDOUT, ">&",PARENT) or die "Can't dup stdout: $!\n"; open(STDIN, "<&",PARENT) or die "Can't dup stdin: $!\n"; exec "./fill.pl" or die "Can't start my program: $!\n"; shutdown(CHILD,1);
#!/usr/bin/perl print <<END; bla bla bla bla bla bla lb alb blla bla bla bla bla bla END ASK: print "Are you ready? > \n"; $a=<STDIN>; if ($a =~ /yes/) {print "bla bla bla";exit 0;} else {goto ASK;}
hope this helps
In reply to Re: Communicating with unflushed child process
by insaniac
in thread Communicating with unflushed child process
by gri6507
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |