|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-03-25 16:24 UTC] mattwil@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 13:00:01 2025 UTC |
Description: ------------ The function proc_get_status returns a wrong PID Reproduce code: --------------- <?php $cmd = 'notepad'; $descriptorspec = array( 0 => array('pipe', 'r' ), 1 => array('pipe', 'w' ), 2 => array('pipe', 'w' ) ); $process = proc_open($cmd, $descriptorspec, $pipes); $status = proc_get_status( $process ); echo 'PID = ', $status['pid'], "\n"; passthru( 'tasklist /fi "imagename eq notepad.exe"'); echo "\n\n"; passthru( 'tasklist /fi "pid eq ' . $status['pid'] . '"' ); echo "\n\n"; proc_terminate($process); ?> Expected result: ---------------- PID = 2408 Abbildname PID Sitzungsname Sitz.-Nr. Speichernutzung ========================= ===== ================ ========== =============== notepad.exe 2408 Console 0 2.560 K Abbildname PID Sitzungsname Sitz.-Nr. Speichernutzung ========================= ===== ================ ========== =============== cmd.exe 2336 Console 0 2.560 K Actual result: -------------- PID = 2336 Abbildname PID Sitzungsname Sitz.-Nr. Speichernutzung ========================= ===== ================ ========== =============== notepad.exe 2408 Console 0 2.560 K Abbildname PID Sitzungsname Sitz.-Nr. Speichernutzung ========================= ===== ================ ========== =============== cmd.exe 2336 Console 0 2.560 K