multi_timeout 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/multi_timeout/version.rb +1 -1
- data/lib/multi_timeout.rb +12 -3
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5adcedd7acbe7bdc5e9bf80656b6155effc28ff
|
4
|
+
data.tar.gz: 6868dc91d8edd301604ae7e30364173348f9a178
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0522ff701fd8f7733af8121cfb99aac8904b8fcdef470414f5dea742b30b4bbf2eec5b66c47609e37268c27cbb4c0f9faf7b2527f3cbe39b29268875e5ee47f1
|
7
|
+
data.tar.gz: 9f03c222e690f8fdf21866d174bea800a4a87bcef3ad3d3faf1c649cb2d3b3f732c2b9638dd856ff7fca0cbda158ca4b8e12d33fd9a8280863fa9cd88ac93241
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/multi_timeout.rb
CHANGED
@@ -19,7 +19,8 @@ module MultiTimeout
|
|
19
19
|
|
20
20
|
options[:timeouts].each do |signal, t|
|
21
21
|
if now >= t
|
22
|
-
|
22
|
+
options[:timeouts].delete([signal, t])
|
23
|
+
puts "Killing '#{command}' with signal #{signal} after #{now} seconds"
|
23
24
|
Process.kill(signal, pid)
|
24
25
|
end
|
25
26
|
end
|
@@ -43,7 +44,7 @@ module MultiTimeout
|
|
43
44
|
def parse_options(argv)
|
44
45
|
options = {:timeouts => []}
|
45
46
|
options[:timeouts], argv = consume_signals(argv)
|
46
|
-
|
47
|
+
options[:command], argv = consume_command(argv)
|
47
48
|
|
48
49
|
OptionParser.new do |opts|
|
49
50
|
opts.banner = <<-BANNER.gsub(/^ {10}/, "")
|
@@ -60,11 +61,19 @@ module MultiTimeout
|
|
60
61
|
end.parse!(argv)
|
61
62
|
|
62
63
|
raise "No timeouts given" if options[:timeouts].empty?
|
63
|
-
options[:command] = Shellwords.shelljoin(argv)
|
64
64
|
|
65
65
|
options
|
66
66
|
end
|
67
67
|
|
68
|
+
def consume_command(argv)
|
69
|
+
argv = argv.dup
|
70
|
+
options = []
|
71
|
+
while argv.first =~ /^-/
|
72
|
+
options << argv.shift
|
73
|
+
end
|
74
|
+
return Shellwords.shelljoin(argv), options
|
75
|
+
end
|
76
|
+
|
68
77
|
def consume_signals(argv)
|
69
78
|
timeouts = []
|
70
79
|
signal = nil
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multi_timeout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
F5etKHZg0j3eHO31/i2HnswY04lqGImUu6aM5EnijFTB7PPW2KwKKM4+kKDYFdlw
|
31
31
|
/0WV1Ng2/Y6qsHwmqGg2VlYj2h4=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2014-03-
|
33
|
+
date: 2014-03-12 00:00:00.000000000 Z
|
34
34
|
dependencies: []
|
35
35
|
description:
|
36
36
|
email: michael@grosser.it
|
metadata.gz.sig
CHANGED
Binary file
|