Perl fork and kill - kill(0, $pid) always returns 1, and can't kill the child

后端 未结 6 873
孤独总比滥情好
孤独总比滥情好 2021-01-06 07:16

I am running a perl script on a Linux host. I\'m trying to write a script that forks, where the child starts a program that takes forever and the parent times out after 5 s

6条回答
  •  独厮守ぢ
    2021-01-06 07:25

    Chances are that you are useing neither strict nor POSIX in your script, so SIGTERM is being interpreted as the bareword "SIGTERM", which isn't behaving in a useful way.

    use strict to make this accidental bareword into an error, then use POSIX to pull in the SIGTERM constant.

提交回复
热议问题