我的问题是,这是预期的(为什么?)和/或这种行为在其他系统上看到吗?
环境:
# cat /etc/*-release CentOS release 6.6 (Final) ... # perl -v This is perl,v5.10.1 (*) built for x86_64-linux-thread-multi ... # PHP -v PHP 5.4.41 (cli) (built: May 14 2015 23:15:28) ...
mini.pl:
#!/usr/bin/perl exec('/usr/bin/PHP -v');
运行它并查看挂起的PHP进程:
# perl mini.pl & [2] 16958 [1] Killed perl mini.pl # ps ax | grep 16958 16958 pts/2 T 0:00 /usr/bin/PHP -v 16960 pts/2 S+ 0:00 grep 16958 [2]+ Stopped perl mini.pl
但是如果我关闭STDIN:
mini.pl:
#!/usr/bin/perl close(STDIN); exec('/usr/bin/PHP -v');
运行正常
# perl mini.pl & [1] 16976 # PHP 5.4.41 (cli) (built: May 14 2015 23:15:28) ... [1]+ Done perl mini.pl # ps ax | grep 16976 16978 pts/2 S+ 0:00 grep 16976
其他注意事项
>我无法在Mac OS X上重现这种挂起的行为(perl 5.18.2,PHP 5.5.24)
谢谢,