1--TEST-- 2Bug #39322 (proc_terminate() losing process resource) 3--SKIPIF-- 4<?php 5if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); 6if (!is_executable('/bin/sleep')) echo 'skip sleep not found'; 7?> 8--FILE-- 9<?php 10$descriptors = array( 11 0 => array('pipe', 'r'), 12 1 => array('pipe', 'w'), 13 2 => array('pipe', 'w')); 14 15$pipes = array(); 16 17$process = proc_open('/bin/sleep 120', $descriptors, $pipes); 18 19proc_terminate($process, 9); 20sleep(1); // wait a bit to let the process finish 21var_dump(proc_get_status($process)); 22 23echo "Done!\n"; 24 25?> 26--EXPECTF-- 27array(9) { 28 ["command"]=> 29 string(14) "/bin/sleep 120" 30 ["pid"]=> 31 int(%d) 32 ["cached"]=> 33 bool(false) 34 ["running"]=> 35 bool(false) 36 ["signaled"]=> 37 bool(true) 38 ["stopped"]=> 39 bool(false) 40 ["exitcode"]=> 41 int(-1) 42 ["termsig"]=> 43 int(9) 44 ["stopsig"]=> 45 int(0) 46} 47Done! 48