PHP Readline: Get a new prompt on SIGINT

leo*_*108 5 php signals readline pcntl

I'm writing a php cli interactive program, it act as a shell by using readline extension.

But I find that when I press Ctrl + C, the whole program exits. I hope it can get a new prompt instead of exit (just like bash).

So I try pcntl_signal to handle the SIGINT

pcntl_signal(SIGINT, SIG_IGN);
Run Code Online (Sandbox Code Playgroud)

It doesn't exit and response nothing (just like dead)

I change the code to:

pcntl_signal(SIGINT, function(){
    echo "\n";
});
Run Code Online (Sandbox Code Playgroud)

这次它打印^C但没有新行,当我按下Enter这些时,提示之前是一个新行。

我已阅读的Readline:获取新的提示上SIGINT,但它的使用C,我发现没有任何siglongjmp的功能php

所以我想知道当我按下Ctrl+时是否有可能得到一个新的提示C