1--TEST-- 2proc_open 3--SKIPIF-- 4<?php 5if (!is_executable('/bin/sleep')) echo 'skip no sleep'; 6if (getenv('SKIP_SLOW_TESTS')) echo 'skip slow test'; 7?> 8--FILE-- 9<?php 10$ds = array(array('pipe', 'r')); 11 12$cat = proc_open( 13 ['/bin/sleep', '2'], 14 $ds, 15 $pipes 16); 17 18usleep(20000); // let the OS run the sleep process before sending the signal 19 20var_dump(proc_terminate($cat, 0)); // status check 21usleep(20000); 22var_dump(proc_get_status($cat)); 23 24var_dump(proc_terminate($cat)); // now really quit it 25usleep(20000); 26var_dump(proc_get_status($cat)); 27 28proc_close($cat); 29 30echo "Done!\n"; 31 32?> 33--EXPECTF-- 34bool(true) 35array(8) { 36 ["command"]=> 37 string(10) "/bin/sleep" 38 ["pid"]=> 39 int(%d) 40 ["running"]=> 41 bool(true) 42 ["signaled"]=> 43 bool(false) 44 ["stopped"]=> 45 bool(false) 46 ["exitcode"]=> 47 int(-1) 48 ["termsig"]=> 49 int(0) 50 ["stopsig"]=> 51 int(0) 52} 53bool(true) 54array(8) { 55 ["command"]=> 56 string(10) "/bin/sleep" 57 ["pid"]=> 58 int(%d) 59 ["running"]=> 60 bool(false) 61 ["signaled"]=> 62 bool(true) 63 ["stopped"]=> 64 bool(false) 65 ["exitcode"]=> 66 int(-1) 67 ["termsig"]=> 68 int(15) 69 ["stopsig"]=> 70 int(0) 71} 72Done! 73