From d05d2b37ba010cb52d34b7d1a551ee8888aa7126 Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Sun, 3 Jul 2016 19:43:04 +0200 Subject: kill process at the end --- lrep | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lrep b/lrep index 4a98148..b71fd83 100755 --- a/lrep +++ b/lrep @@ -91,3 +91,12 @@ while line = gets puts line end end + +if pid + n = 0 + until Process.waitpid(pid, Process::WNOHANG) + Process.kill(n > 10 ? "KILL" : "TERM", pid) + sleep 0.1 + n += 1 + end +end -- cgit 1.4.1