Skip to content

Commit 23040e4

Browse files
committed
fake cli too
1 parent 6b3408c commit 23040e4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

frankenphp.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,6 +1399,10 @@ static void *execute_script_cli(void *arg) {
13991399
void *exit_status;
14001400
bool eval = (bool)arg;
14011401

1402+
#ifndef PHP_WIN32
1403+
pthread_atfork(NULL, NULL, frankenphp_fork_child);
1404+
#endif
1405+
14021406
/*
14031407
* The SAPI name "cli" is hardcoded into too many programs... let's usurp it.
14041408
*/
@@ -1423,6 +1427,12 @@ static void *execute_script_cli(void *arg) {
14231427
}
14241428
zend_end_try();
14251429

1430+
#ifndef PHP_WIN32
1431+
if (is_forked_child) {
1432+
_exit(EG(exit_status));
1433+
}
1434+
#endif
1435+
14261436
exit_status = (void *)(intptr_t)EG(exit_status);
14271437

14281438
php_embed_shutdown();

0 commit comments

Comments
 (0)