summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-03-10 17:12:26 +0100
committerPatrick Simianer <p@simianer.de>2014-03-10 17:12:26 +0100
commitaba7c124e3402a39a8237a7ae0ec4bc15f4016ce (patch)
tree2011c58320f80f8d29e66c3b3e07d574bedad8ef
parent6fc9c7ce2171687ac3319973d1af02904b06b790 (diff)
ignore_fail for spawn_with_timeout
-rw-r--r--lib/nlp_ruby/misc.rb4
-rw-r--r--nlp_ruby.gemspec4
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/nlp_ruby/misc.rb b/lib/nlp_ruby/misc.rb
index b2ab885..0319a5f 100644
--- a/lib/nlp_ruby/misc.rb
+++ b/lib/nlp_ruby/misc.rb
@@ -58,14 +58,14 @@ class PriorityQueue
end
end
-def spawn_with_timeout cmd, t=4, debug=false
+def spawn_with_timeout cmd, t=4, ignore_fail=false, debug=false
STDERR.write cmd+"\n" if debug
pipe_in, pipe_out = IO.pipe
pid = Process.spawn(cmd, :out => pipe_out)
begin
Timeout.timeout(t) { Process.wait pid }
rescue Timeout::Error
- Process.kill('TERM', pid)
+ Process.kill('TERM', pid) if !ignore_fail
end
pipe_out.close
return pipe_in.read
diff --git a/nlp_ruby.gemspec b/nlp_ruby.gemspec
index 85a3c9b..1b7ac8d 100644
--- a/nlp_ruby.gemspec
+++ b/nlp_ruby.gemspec
@@ -1,7 +1,7 @@
Gem::Specification.new do |s|
s.name = 'nlp_ruby'
- s.version = '0.4'
- s.date = '2014-02-25'
+ s.version = '0.4.1'
+ s.date = '2014-03-10'
s.summary = 'nlp_ruby'
s.description = 'NLP related tools and classes'
s.authors = ['Patrick Simianer']