Skip to content

Commit 27e3d64

Browse files
committed
Add optional signal parameter to proc_terminate.
1 parent c3c2405 commit 27e3d64

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ext/standard/proc_open.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,15 @@ PHP_MINIT_FUNCTION(proc_open)
175175
}
176176

177177

178-
/* {{{ proto int proc_terminate(resource process)
178+
/* {{{ proto int proc_terminate(resource process [, long signal])
179179
kill a process opened by proc_open */
180180
PHP_FUNCTION(proc_terminate)
181181
{
182182
zval *zproc;
183183
struct php_process_handle *proc;
184+
long sig_no = SIGTERM;
184185

185-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zproc) == FAILURE) {
186+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &zproc, &sig_no) == FAILURE) {
186187
RETURN_FALSE;
187188
}
188189

@@ -191,7 +192,7 @@ PHP_FUNCTION(proc_terminate)
191192
#ifdef PHP_WIN32
192193
TerminateProcess(proc->child, 255);
193194
#else
194-
kill(proc->child, SIGTERM);
195+
kill(proc->child, sig_no);
195196
#endif
196197

197198
zend_list_delete(Z_LVAL_P(zproc));

0 commit comments

Comments
 (0)