diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2016-07-03 19:43:04 +0200 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2016-07-03 19:43:04 +0200 |
commit | d05d2b37ba010cb52d34b7d1a551ee8888aa7126 (patch) | |
tree | 959ef350cde1dcf32bd0de36103311f3cb0aa5b5 | |
parent | c7009c75fbc2efc1d71cd2d9709cdedd11fe0330 (diff) | |
download | lrep-d05d2b37ba010cb52d34b7d1a551ee8888aa7126.tar.gz lrep-d05d2b37ba010cb52d34b7d1a551ee8888aa7126.tar.xz lrep-d05d2b37ba010cb52d34b7d1a551ee8888aa7126.zip |
kill process at the end
-rwxr-xr-x | lrep | 9 |
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 |