mirror of
https://github.com/danog/ext-uv.git
synced 2024-11-30 04:29:01 +01:00
Fix closing failed uv_spawn() (Closes #79)
This commit is contained in:
parent
082fdfb203
commit
1682ecf99f
2
php_uv.c
2
php_uv.c
@ -5122,7 +5122,7 @@ PHP_FUNCTION(uv_spawn)
|
|||||||
ret = uv_spawn(&loop->loop, &proc->uv.process, &options);
|
ret = uv_spawn(&loop->loop, &proc->uv.process, &options);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
PHP_UV_DEINIT_UV(proc);
|
OBJ_RELEASE(&proc->std);
|
||||||
RETVAL_LONG(ret);
|
RETVAL_LONG(ret);
|
||||||
} else {
|
} else {
|
||||||
php_uv_cb_init(&cb, proc, &fci, &fcc, PHP_UV_PROC_CLOSE_CB);
|
php_uv_cb_init(&cb, proc, &fci, &fcc, PHP_UV_PROC_CLOSE_CB);
|
||||||
|
22
tests/800-broken-uv_spawn-issue-79.phpt
Normal file
22
tests/800-broken-uv_spawn-issue-79.phpt
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
--TEST--
|
||||||
|
Bad uv_spawn must not segfault (issue #79)
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
$rt = uv_spawn(
|
||||||
|
uv_default_loop(),
|
||||||
|
'',
|
||||||
|
array(),
|
||||||
|
array(),
|
||||||
|
__DIR__,
|
||||||
|
array(),
|
||||||
|
static function () {
|
||||||
|
echo 'Child Process exited'.PHP_EOL;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
var_dump($rt);
|
||||||
|
|
||||||
|
uv_run();
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
int(-%d)
|
Loading…
Reference in New Issue
Block a user