Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Commit

Permalink
Fix signal handling for PHP 7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Cobi committed Mar 7, 2019
1 parent be30062 commit e875c03
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bot/cluebot-ng.php
Expand Up @@ -20,17 +20,19 @@
* You should have received a copy of the GNU General Public License
* along with ClueBot NG. If not, see <http://www.gnu.org/licenses/>.
*/
declare (ticks=1);
require_once 'includes.php';

pcntl_signal(SIGCHLD, function ($signo) {
pcntl_async_signals(true);
pcntl_signal(SIGCHLD, function ($signo, $siginfo) {
switch ($signo) {
case SIGCHLD:
echo "Got SIGCHLD ...\n";
while (($x = pcntl_waitpid(0, $status, WNOHANG)) != -1) {
if ($x == 0) {
break;
}
$status = pcntl_wexitstatus($status);
echo "PID $x exited with status $status\n";
}
break;
}
Expand Down

0 comments on commit e875c03

Please sign in to comment.