-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not wait when the child process does not exist (#3832)
- Loading branch information
Showing
2 changed files
with
42 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--TEST-- | ||
swoole_runtime/proc: proc_close() after wait | ||
--SKIPIF-- | ||
<?php require __DIR__ . '/../../include/skipif.inc'; ?> | ||
--FILE-- | ||
<?php | ||
require __DIR__ . '/../../include/bootstrap.php'; | ||
|
||
include_once dirname(__FILE__) . "/proc_open_pipes.inc"; | ||
Swoole\Runtime::enableCoroutine(); | ||
|
||
Co\run(function() { | ||
$descriptorspec = array( | ||
0 => array("pipe", "/dev/null"), | ||
1 => array("pipe", "/dev/null"), | ||
2 => array("pipe", "/dev/null") | ||
); | ||
|
||
$proc = proc_open('/bin/sleep 30', $descriptorspec, $pipes); | ||
Assert::notEmpty($proc); | ||
echo "wait begin\n"; | ||
|
||
go(function() use($proc) { | ||
usleep(100000); | ||
proc_terminate($proc); | ||
}); | ||
|
||
$info = Co\System::wait(); | ||
Assert::notEmpty($info); | ||
echo "wait end\n"; | ||
proc_close($proc); | ||
echo "proc_close end\n"; | ||
}); | ||
?> | ||
--EXPECTF-- | ||
wait begin | ||
wait end | ||
proc_close end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters