Annotation of embedaddon/php/ext/standard/tests/general_functions/proc_open02.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: proc_open
                      3: --SKIPIF--
                      4: <?php
                      5: if (!is_executable('/bin/sleep')) echo 'skip no sleep';
                      6: if (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: 
                     18: usleep(20000); // let the OS run the sleep process before sending the signal
                     19: 
                     20: var_dump(proc_terminate($cat, 0)); // status check
                     21: usleep(20000);
                     22: var_dump(proc_get_status($cat));
                     23: 
                     24: var_dump(proc_terminate($cat)); // now really quit it
                     25: usleep(20000);
                     26: var_dump(proc_get_status($cat));
                     27: 
                     28: proc_close($cat);
                     29: 
                     30: echo "Done!\n";
                     31: 
                     32: ?>
                     33: --EXPECTF--
                     34: bool(true)
                     35: array(8) {
                     36:   ["command"]=>
                     37:   string(12) "/bin/sleep 2"
                     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: }
                     53: bool(true)
                     54: array(8) {
                     55:   ["command"]=>
                     56:   string(12) "/bin/sleep 2"
                     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: }
                     72: Done!

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>