home *** CD-ROM | disk | FTP | other *** search
- #
- # test for spawn function under NT
- #
-
- print "1..2\n";
-
-
- pipe(myR, hisW) || die "Can't create my pipes: $!\n";
- pipe(hisR, myW) || die "Can't create his pipes: $!\n";
-
- $cmd = "cmd /c dir/w";
-
- &Spawn($cmd, $pid, hisR, fileno(hisW), hisW) ||
- die ("error spawning command: $!\n"); #
-
- close hisW;
- close hisR;
-
- $found_it = 0;
- while(<myR>) {
- $found_it++ if /Volume Serial Number/;
- }
- close myR;
- close myW;
-
- if ($found_it) {print "ok 1\n";} else {print "not ok 1\n";}
-
- open (T, ">script.$$") || die "Can't open script.$$: $!\n";
- print T "\$line = <>;\n";
- print T "print \$line eq \"input test\\n\" ? \"ok\\n\" : \"not ok\\n\"\n";
- close T;
-
- pipe(myR, hisW) || die "Can't create my pipes: $!\n";
- pipe(hisR, myW) || die "Can't create his pipes: $!\n";
-
- &Spawn ("perl script.$$", $pid, hisR, hisW, hisW) ||
- die ("error spawning write test: $!\n");
-
- close hisR;
- close hisW;
- select(myW);
- $| = 1;
- print "input test\n";
- chop ($response = <myR>);
-
- close myR;
- close myW;
-
- select STDOUT;
-
- print $response, " 2\n";
-
- unlink("script.$$");