aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-07-03 19:43:04 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-07-03 19:43:04 +0200
commitd05d2b37ba010cb52d34b7d1a551ee8888aa7126 (patch)
tree959ef350cde1dcf32bd0de36103311f3cb0aa5b5
parentc7009c75fbc2efc1d71cd2d9709cdedd11fe0330 (diff)
downloadlrep-d05d2b37ba010cb52d34b7d1a551ee8888aa7126.tar.gz
lrep-d05d2b37ba010cb52d34b7d1a551ee8888aa7126.tar.xz
lrep-d05d2b37ba010cb52d34b7d1a551ee8888aa7126.zip
kill process at the end
-rwxr-xr-xlrep9
1 files changed, 9 insertions, 0 deletions
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