ID: 49340 User updated by: alexmontoanelli at gmail dot com Reported By: alexmontoanelli at gmail dot com -Status: Feedback +Status: Open Bug Type: PCNTL related Operating System: Linux PHP Version: 5.2.10 New Comment:
The problem is that I need hit enter - exit from fgets - to run the signal handler - but this is not the correct way - in python for example, the signal handler are calling when the function are waiting for a user input. I found this page - http://br2.php.net/manual/en/function.pcntl-signal.php - the commentary above: '28-Mar-2006 07:26 Process handling is not available when using a blocking socket! Bear this in mind.' There is true? Regards Previous Comments: ------------------------------------------------------------------------ [2009-08-24 08:59:28] der...@php.net Questions asked -> feedback mode ------------------------------------------------------------------------ [2009-08-24 08:54:42] sjo...@php.net Thank you for your bug report. I don't fully understand the problem. Is the problem that you have to hit enter for the signal handler to run? Or that the line with 'echo $foo' is ran after the fgets? ------------------------------------------------------------------------ [2009-08-23 22:12:28] alexmontoanelli at gmail dot com Description: ------------ After executions of certain functions, the handler configured by posix_singal, are not called where the funcion are in execution - like freads. Reproduce code: --------------- #!/usr/bin/php <?php declare(ticks = 1); function handler($a){ echo "Calling handler on signal : $a\n"; } //define handlers for signals pcntl_signal(SIGTERM, 'handler'); pcntl_signal(SIGINT, 'handler'); //if you send a signal, the function fgets are waiting for a user input, he is not called, until you enter something $foo = fgets(STDIN); echo $foo; Expected result: ---------------- alexmm tmp # php a.php ^C Calling handler on signal : 2 Actual result: -------------- alexmm tmp # php a.php ^C MY_INPUT_AFTER_SEND_CTRL_C Calling handler on signal : 2 MY_INPUT_AFTER_SEND_CTRL_C ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49340&edit=1