mirror of
https://github.com/danog/ext-uv.git
synced 2024-11-30 04:29:01 +01:00
parent
db7ccff3cf
commit
2b5a298f82
11
php_uv.c
11
php_uv.c
@ -5209,7 +5209,7 @@ PHP_FUNCTION(uv_spawn)
|
||||
zval *zloop, *args, *env, *zoptions = NULL, *zstdio = NULL, *value;
|
||||
char **command_args, **zenv;
|
||||
zend_string *command, *cwd;
|
||||
int uid = 0, gid = 0, stdio_count = 0;
|
||||
int uid = 0, gid = 0, stdio_count = 0, ret;
|
||||
long flags = 0;
|
||||
zend_fcall_info fci = empty_fcall_info;
|
||||
zend_fcall_info_cache fcc = empty_fcall_info_cache;
|
||||
@ -5332,6 +5332,12 @@ PHP_FUNCTION(uv_spawn)
|
||||
options.gid = gid;
|
||||
|
||||
proc = (php_uv_t *) emalloc(sizeof(php_uv_t));
|
||||
ret = uv_spawn(loop, &proc->uv.process, &options);
|
||||
|
||||
if (ret) {
|
||||
efree(proc);
|
||||
RETURN_LONG(ret);
|
||||
} else {
|
||||
PHP_UV_INIT_ZVALS(proc);
|
||||
php_uv_cb_init(&cb, proc, &fci, &fcc, PHP_UV_PROC_CLOSE_CB);
|
||||
TSRMLS_SET_CTX(proc->thread_ctx);
|
||||
@ -5342,8 +5348,7 @@ PHP_FUNCTION(uv_spawn)
|
||||
proc->resource_id = zend_register_resource(proc, uv_resource_handle);
|
||||
ZVAL_RES(return_value, proc->resource_id);
|
||||
zval_copy_ctor(return_value);
|
||||
|
||||
uv_spawn(loop, &proc->uv.process, &options);
|
||||
}
|
||||
|
||||
if (zenv != NULL) {
|
||||
char **p = zenv;
|
||||
|
Loading…
Reference in New Issue
Block a user