ruby timeouts and system commands

前端 未结 4 1854
傲寒
傲寒 2020-12-09 16:13

I have a ruby timeout that calls a system (bash) command like this..

Timeout::timeout(10) {
  `my_bash_command -c12 -o text.txt`
}

but I th

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-09 16:41

    Handling processes, signals and timers is not very easy. That's why you might consider delegating this task: Use the command timeout on new versions of Linux:

    timeout --kill-after 5s 10s my_bash_command -c12 -o text.txt
    

提交回复
热议问题