How can I specify timeout limit for Perl system call?

后端 未结 4 367
花落未央
花落未央 2020-12-24 06:28

Sometimes my system call goes into a never ending state. To, avoid that I want to be able to break out of the call after a specified amount of time.

Is there a way t

4条回答
  •  眼角桃花
    2020-12-24 07:26

    How about System::Timeout ?

    This module extends system to allow timeout after the specified seconds.

    timeout("3", "sleep 9"); # timeout exit after 3 seconds
    

提交回复
热议问题