execute 0.1.38 → 0.1.39

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cmd.rb +3 -3
  3. data/lib/timeout_error.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e53805a153153e7e3725988c6a5996c39a0bf8f
4
- data.tar.gz: ad3c028e120da725a0107b02f58f79e376a0f49e
3
+ metadata.gz: 38fb4647be1c94c5513f80514adde8b97b618eb9
4
+ data.tar.gz: 02125021c9178df1f7c4944abdee1cd64c77b19e
5
5
  SHA512:
6
- metadata.gz: 36063ba89c1baeba1689619cd691c34acf236da671c71dae63745f89fbbdc408d05b6ca6f3f68e8b7ef67fca3e343abe913cd46ed476da0dc626dcf5d87de6ee
7
- data.tar.gz: 5e78c0d9cb7304b976a22f3bee9250b3639be08dcd24da132811505ac6b45cfc6540197062107b691a2a3fc179387a2eca77101edd9cbc42354ba2b5fd13b963
6
+ metadata.gz: f85781a0f832f5bdb25cf4e880dcb659725fd826b1e1d74ca8f32f92a35d47a36212c11bbea3296eb08b9554245a4d567051d591713e11250266285aa4b19995
7
+ data.tar.gz: 13d94191b6c1cb315871be2a637b0b9a18847e46947a17ce1d4f0e12f48c409df4e298e97cde22a6e12e6facb931303010a4d484bdbfdf13f9caa31f8f9f65b3
data/lib/cmd.rb CHANGED
@@ -38,14 +38,13 @@ class CMD < Hash
38
38
  puts "exit_code: #{self[:exit_code]}"
39
39
  end
40
40
 
41
+ raise TimeoutError.new(self[:command], self[:timeout]) if(key?(:timed_out))
41
42
  if((self[:exit_code] != 0) && !self[:ignore_exit_code])
42
43
  exception_text = "Exit code: #{self[:exit_code]}"
43
44
  exception_text = "#{exception_text}\nError: '#{self[:error]}'"
44
45
  exception_text = "#{exception_text}\nOutput: '#{self[:output]}'"
45
46
  raise StandardError.new(exception_text)
46
47
  end
47
-
48
- raise TimedOutError.new(self[:command], self[:timeout]) if(key?(:timed_out))
49
48
  end
50
49
 
51
50
  def system
@@ -65,7 +64,8 @@ class CMD < Hash
65
64
  sleep(0.1)
66
65
  if((Time.now - start_time).to_f > self[:timeout])
67
66
  self[:timed_out] = true
68
- wait_thr.kill
67
+ Process.kill('KILL',wait_thr.pid)
68
+ sleep(0.1)
69
69
  end
70
70
  end
71
71
  end
@@ -1,4 +1,4 @@
1
- class TimedOutError < StandardError
1
+ class TimeoutError < RuntimeError
2
2
  def initialize(cmd, seconds)
3
3
  @message = "#{cmd} timed out after #{seconds} seconds"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: execute
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.38
4
+ version: 0.1.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Marshall