SYN SYN
[p5sagit/p5-mst-13.2.git] / t / io / openpid.t
index 2d3ac9f..3871e0b 100755 (executable)
@@ -1,4 +1,3 @@
-
 #!./perl
 
 #####################################################################
 
 BEGIN {
     chdir 't' if -d 't';
-    unshift @INC, '../lib';
+    @INC = '../lib';
+    if ($^O eq 'dos') {
+        print "1..0 # Skip: no multitasking\n";
+        exit 0;
+    }
 }
 
 
 use FileHandle;
+use Config;
 autoflush STDOUT 1;
 $SIG{PIPE} = 'IGNORE';
 
 print "1..10\n";
 
-$perl = "$^X -I../lib";
+$perl = qq[$^X "-I../lib"];
 
 #
 # commands run 4 perl programs.  Two of these programs write a
@@ -50,12 +54,15 @@ print "ok 4\n";
 
 print "# pids were $pid1, $pid2, $pid3, $pid4\n";
 
+my $killsig = 'HUP';
+$killsig = 1 unless $Config{sig_name} =~ /\bHUP\b/;
+
 # get message from first process and kill it
 chomp($from_pid1 = scalar(<FH1>));
 print "# child1 returned [$from_pid1]\nnot "
     unless $from_pid1 eq 'first process';
 print "ok 5\n";
-$kill_cnt = kill STOP, $pid1;
+$kill_cnt = kill $killsig, $pid1;
 print "not " unless $kill_cnt == 1;
 print "ok 6\n";
 
@@ -64,7 +71,7 @@ chomp($from_pid2 = scalar(<FH2>));
 print "# child2 returned [$from_pid2]\nnot "
     unless $from_pid2 eq 'second process';
 print "ok 7\n";
-$kill_cnt = kill STOP, $pid2, $pid3;
+$kill_cnt = kill $killsig, $pid2, $pid3;
 print "not " unless $kill_cnt == 2;
 print "ok 8\n";
 
@@ -74,5 +81,5 @@ print FH4 "ok 9\n";
 print "# waiting for process $pid4 to exit\n";
 $reap_pid = waitpid $pid4, 0;
 print "# reaped pid $reap_pid != $pid4\nnot "
-    unless $reap_pid == $pid4;
+    unless $reap_pid == $pid4;         
 print "ok 10\n";