-
-
Notifications
You must be signed in to change notification settings - Fork 131
Closed
Labels
Description
Hi everyone, I'm trying to suspend a process (to send it in background/foreground on demand), but something is not working as expected.
This is my test code:
<?php
require __DIR__ . '/../vendor/autoload.php';
$loop = React\EventLoop\Factory::create();
$loop->addSignal(SIGTSTP, function () { echo 'SIGTSTP' . PHP_EOL; });
$loop->run();And this is the result:
domenico@devtop:~$ php test.php
^ZSIGTSTP
^ZSIGTSTP
^ZSIGTSTP
^C
As you can see from the terminal output, the signal is intercepted, but nothing happens, the process is not suspended.
If I try to do the same action without a loop (for example with the following code) the process is suspended:
domenico@devtop:~$ php -r "sleep(5); echo 'hello'.PHP_EOL;"
^Z
[1]+ Stopped php -r "sleep(5); echo 'ciao'.PHP_EOL;"
domenico@devtop:~$ fg
php -r "sleep(5); echo 'ciao'.PHP_EOL;"
ciao
Why is this happening? Am I wrong?
I'm using the event-loop version 1.1.1 (2020-01-01).
domenico@devtop:~$ php -v
PHP 7.2.24-0ubuntu0.18.04.3 (cli) (built: Feb 11 2020 15:55:52) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.24-0ubuntu0.18.04.3, Copyright (c) 1999-2018, by Zend Technologies
domenico@devtop:~$ php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
gnupg
hash
iconv
imagick
imap
intl
json
ldap
libxml
mbstring
mysqli
mysqlnd
OAuth
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
sqlite3
ssh2
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
yaml
Zend OPcache
zip
zlib
zmq
[Zend Modules]
Zend OPcache