Bug #64465 [Opn->Nab]: proc_get_status update time when using proc_terminate
| From: | aharvey@php.net | Date: | Wed, 20 Mar 2013 19:16:37 +0000 |
| Subject: | Bug #64465 [Opn->Nab]: proc_get_status update time when using proc_terminate | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-177932@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64465&edit=1
ID: 64465
Updated by: aharvey@php.net
Reported by: andrey dot kalinovsky at gmail dot com
Summary: proc_get_status update time when using
proc_terminate
-Status: Open
+Status: Not a bug
Type: Bug
Package: Program Execution
Operating System: OSX, Ubuntu
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
proc_terminate() is documented as being asynchronous in the manual â all it
really does internally is to call kill(), which simply sends a signal.
pcntl_waitpid() is presumably what you need to call after proc_terminate(), if
you don't want to poll with proc_get_status().
Previous Comments:
------------------------------------------------------------------------
[2013-03-20 15:56:39] andrey dot kalinovsky at gmail dot com
This is a big issue when working with libev eventloop, since it's about handling
child processes asynchronously. So, I can't just let the sleep(1) here, the
solution must be asynchronous...
------------------------------------------------------------------------
[2013-03-20 15:32:26] andrey dot kalinovsky at gmail dot com
Description:
------------
After proc_terminate has been called, there is a time during which proc_get_status
will still describe the child process as running.
Test script:
---------------
<?php
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("pipe", "w")
);
$process = proc_open("sleep 20", $descriptorspec, $pipes);
var_dump(proc_get_status($process));
proc_terminate($process);
var_dump(proc_get_status($process));
sleep(1);
var_dump(proc_get_status($process));
Expected result:
----------------
array(8) {
'command' =>
string(8) "sleep 20"
'pid' =>
int(14027)
'running' =>
bool(true)
'signaled' =>
bool(false)
'stopped' =>
bool(false)
'exitcode' =>
int(-1)
'termsig' =>
int(0)
'stopsig' =>
int(0)
}
array(8) {
'command' =>
string(8) "sleep 20"
'pid' =>
int(14027)
'running' =>
bool(false)
'signaled' =>
bool(true)
'stopped' =>
bool(false)
'exitcode' =>
int(-1)
'termsig' =>
int(15)
'stopsig' =>
int(0)
}
array(8) {
'command' =>
string(8) "sleep 20"
'pid' =>
int(14027)
'running' =>
bool(false)
'signaled' =>
bool(true)
'stopped' =>
bool(false)
'exitcode' =>
int(-1)
'termsig' =>
int(15)
'stopsig' =>
int(0)
}
Actual result:
--------------
array(8) {
'command' =>
string(8) "sleep 20"
'pid' =>
int(14027)
'running' =>
bool(true)
'signaled' =>
bool(false)
'stopped' =>
bool(false)
'exitcode' =>
int(-1)
'termsig' =>
int(0)
'stopsig' =>
int(0)
}
array(8) {
'command' =>
string(8) "sleep 20"
'pid' =>
int(14027)
'running' =>
bool(true)
'signaled' =>
bool(false)
'stopped' =>
bool(false)
'exitcode' =>
int(-1)
'termsig' =>
int(0)
'stopsig' =>
int(0)
}
array(8) {
'command' =>
string(8) "sleep 20"
'pid' =>
int(14027)
'running' =>
bool(false)
'signaled' =>
bool(true)
'stopped' =>
bool(false)
'exitcode' =>
int(-1)
'termsig' =>
int(15)
'stopsig' =>
int(0)
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64465&edit=1