]> granicus.if.org Git - php/commitdiff
This test was added to verify that bug 39322 was fixed, which the test
authorRasmus Lerdorf <rasmus@php.net>
Wed, 7 Sep 2011 18:09:34 +0000 (18:09 +0000)
committerRasmus Lerdorf <rasmus@php.net>
Wed, 7 Sep 2011 18:09:34 +0000 (18:09 +0000)
does test for and this works. However, it consistently failed because
it relied on a SIGHUP not terminating a sh -c /usr/bin/nohup sleep 50
process which doesn't work because the SIGHUP goes to the sh process
not the nohup'ed sleep process. So, I have sped up the test and removed
the nohup and instead of trying to SIGHUP I am just doing the equivalent
of a kill 0 on it to verify that the resource sticks around.

ext/standard/tests/general_functions/proc_open02.phpt

index 3406f6806c58cebe47fece8d5b04ed45e396e3f5..d5d878ed241bab7a9a95f3f0828f9f878dede2cd 100644 (file)
@@ -3,7 +3,6 @@ proc_open
 --SKIPIF--
 <?php
 if (!is_executable('/bin/sleep')) echo 'skip no sleep';
-if (!is_executable('/usr/bin/nohup')) echo 'skip no nohup';
 if (getenv('SKIP_SLOW_TESTS')) echo 'skip slow test';
 ?>
 --FILE--
@@ -11,19 +10,19 @@ if (getenv('SKIP_SLOW_TESTS')) echo 'skip slow test';
 $ds = array(array('pipe', 'r'));
 
 $cat = proc_open(
-       '/usr/bin/nohup /bin/sleep 50',
+       '/bin/sleep 2',
        $ds,
        $pipes
 );
 
-sleep(1); // let the OS run the nohup process before sending the signal
+usleep(20000); // let the OS run the sleep process before sending the signal
 
-var_dump(proc_terminate($cat, 1)); // send a SIGHUP
-sleep(1);
+var_dump(proc_terminate($cat, 0)); // status check
+usleep(20000);
 var_dump(proc_get_status($cat));
 
 var_dump(proc_terminate($cat)); // now really quit it
-sleep(1);
+usleep(20000);
 var_dump(proc_get_status($cat));
 
 proc_close($cat);
@@ -35,7 +34,7 @@ echo "Done!\n";
 bool(true)
 array(8) {
   ["command"]=>
-  string(28) "/usr/bin/nohup /bin/sleep 50"
+  string(12) "/bin/sleep 2"
   ["pid"]=>
   int(%d)
   ["running"]=>
@@ -54,7 +53,7 @@ array(8) {
 bool(true)
 array(8) {
   ["command"]=>
-  string(28) "/usr/bin/nohup /bin/sleep 50"
+  string(12) "/bin/sleep 2"
   ["pid"]=>
   int(%d)
   ["running"]=>