You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
40
vendor/swoole/tests/swoole_process/swoole_process_wait.phpt
vendored
Executable file
40
vendor/swoole/tests/swoole_process/swoole_process_wait.phpt
vendored
Executable file
@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
swoole_process: wait
|
||||
--SKIPIF--
|
||||
<?php require __DIR__ . '/../include/skipif.inc'; ?>
|
||||
--INI--
|
||||
assert.active=1
|
||||
assert.warning=1
|
||||
assert.bail=0
|
||||
assert.quiet_eval=0
|
||||
|
||||
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . '/../include/bootstrap.php';
|
||||
|
||||
$proc = new \swoole_process(function() {});
|
||||
$pid = $proc->start();
|
||||
$info = \swoole_process::wait(true);
|
||||
assert($pid === $info["pid"]);
|
||||
assert($info["code"] === 0);
|
||||
assert($info["signal"] === 0);
|
||||
|
||||
$proc = new \swoole_process(function() { exit(1); });
|
||||
$pid = $proc->start();
|
||||
$info = \swoole_process::wait(true);
|
||||
assert($pid === $info["pid"]);
|
||||
assert($info["code"] === 1);
|
||||
assert($info["signal"] === 0);
|
||||
|
||||
$proc = new \swoole_process(function() { \swoole_process::kill(posix_getpid(), SIGTERM); });
|
||||
$pid = $proc->start();
|
||||
$info = \swoole_process::wait(true);
|
||||
assert($pid === $info["pid"]);
|
||||
assert($info["code"] === 0);
|
||||
assert($info["signal"] === SIGTERM);
|
||||
|
||||
echo "SUCCESS";
|
||||
?>
|
||||
--EXPECT--
|
||||
SUCCESS
|
Reference in New Issue
Block a user