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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48d71cc32b686a996440a80637e22c1da0f1f093
4
- data.tar.gz: dcc94b0b6ba333df8602be27df16846b9ae532fc
3
+ metadata.gz: d5adcedd7acbe7bdc5e9bf80656b6155effc28ff
4
+ data.tar.gz: 6868dc91d8edd301604ae7e30364173348f9a178
5
5
  SHA512:
6
- metadata.gz: 5ac3d8c8059beeddc9fd5f23d1bf797ba7786cf046c152a64a7b6e97785b0779e3e021c6352d1bc13b3d9d3de15742650a7440922794b862a508f5995fb24251
7
- data.tar.gz: 2320339aedcf32b69cb3adf493c78a948bab3ada944f0fc88da9d1a912aed159cc626081d5f708c6f981f5b07faff7e13e55773762564bad7d8dce675f6494fe
6
+ metadata.gz: 0522ff701fd8f7733af8121cfb99aac8904b8fcdef470414f5dea742b30b4bbf2eec5b66c47609e37268c27cbb4c0f9faf7b2527f3cbe39b29268875e5ee47f1
7
+ data.tar.gz: 9f03c222e690f8fdf21866d174bea800a4a87bcef3ad3d3faf1c649cb2d3b3f732c2b9638dd856ff7fca0cbda158ca4b8e12d33fd9a8280863fa9cd88ac93241
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,3 +1,3 @@
1
1
  module MultiTimeout
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
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
- puts "Killing #{command} with signal #{signal} after #{now} seconds"
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.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-11 00:00:00.000000000 Z
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