multi_timeout 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4f1f460fe210454f8a142a9e7ee4d4cf521263d8
4
+ data.tar.gz: 3fb809959c3166c36b2eb4e3bc1980bfb788941d
5
+ SHA512:
6
+ metadata.gz: 684524c40cb2667334c683fe4282a4bb9b03bddc3ad37fd5f5552b5eb0485d12366b2dcd071357e802d8986646795762ed13f2366c87e3c73c685cc475d17257
7
+ data.tar.gz: 5bbc4da08af8baa9de7c69ed7ec924bce96ab73fe4cbdb6e34f5bd6a5dbdc32ae280c84d1ad6a8d1cc5419d4128756dac4baf882603d19c4faa26744ca2f3eac
checksums.yaml.gz.sig ADDED
Binary file
data.tar.gz.sig CHANGED
@@ -1,3 +1 @@
1
- J�#�*�ľ�YAA����i0��*�PJc
2
- *��,�n@~[�py���#��v�@=Q߽�d�_���^�v4Y��I���U���*]}���V�~�?J�tIĔ���6Yy��?���gW)�g�V@/���G]��/�����uM9 cja�4c�CT��At� <T^��^#yr�
3
- O��+ ��P����vC�����j�./�2JB.�?D$��3y�bQ�L:�Ĵ���[���f3������i��̍�tN
1
+ �K�r%H��w|.1�S�'6�_��-�$_e�� &����W������gH���� �F{�Gk� �����@�������1��-� ������*�Ğ%#P�wX �m�lx�w���х��[���FD����g�Z��\ �O–��X��?���:�V�Vڒ�z��bdİYE�N�x�����M���EP08gU��S��.�B3��� ���I�N�tk���[rY�a/T��ۦ��s��* ��9�o�T_Ԅ
data/lib/multi_timeout.rb CHANGED
@@ -12,7 +12,8 @@ module MultiTimeout
12
12
  options = parse_options(argv)
13
13
  command = options[:command]
14
14
 
15
- pid = fork { exec command }
15
+ pid = Process.spawn command, :pgroup => true
16
+ gid = Process.getpgid(pid)
16
17
  Thread.new do
17
18
  now = 0
18
19
  loop do
@@ -21,9 +22,8 @@ module MultiTimeout
21
22
  options[:timeouts].each do |signal, t|
22
23
  if now >= t
23
24
  options[:timeouts].delete([signal, t])
24
- puts "Killing '#{command}' with signal #{signal} after #{now} seconds"
25
- STDOUT.flush # wait instantly terminates and sometimes hides puts
26
- Process.kill(signal, pid)
25
+ puts "Killing '#{truncate(command, 30)}' with signal #{signal} after #{now} seconds"
26
+ Process.kill(signal, -gid)
27
27
  end
28
28
  end
29
29
  now += TICK
@@ -36,6 +36,14 @@ module MultiTimeout
36
36
 
37
37
  private
38
38
 
39
+ def truncate(string, count)
40
+ if string.size > count
41
+ string.slice(0, count-3) + "..."
42
+ else
43
+ string
44
+ end
45
+ end
46
+
39
47
  def dead?(pid)
40
48
  Process.getpgid(pid)
41
49
  false
@@ -1,3 +1,3 @@
1
1
  module MultiTimeout
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
metadata CHANGED
@@ -1,19 +1,13 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: multi_timeout
3
- version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 2
10
- version: 1.0.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.3
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Michael Grosser
14
8
  autorequire:
15
9
  bindir: bin
16
- cert_chain:
10
+ cert_chain:
17
11
  - |
18
12
  -----BEGIN CERTIFICATE-----
19
13
  MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MRAwDgYDVQQDDAdtaWNo
@@ -36,55 +30,41 @@ cert_chain:
36
30
  F5etKHZg0j3eHO31/i2HnswY04lqGImUu6aM5EnijFTB7PPW2KwKKM4+kKDYFdlw
37
31
  /0WV1Ng2/Y6qsHwmqGg2VlYj2h4=
38
32
  -----END CERTIFICATE-----
39
-
40
- date: 2014-03-12 00:00:00 Z
33
+ date: 2014-03-12 00:00:00.000000000 Z
41
34
  dependencies: []
42
-
43
35
  description:
44
36
  email: michael@grosser.it
45
- executables:
37
+ executables:
46
38
  - multi-timeout
47
39
  extensions: []
48
-
49
40
  extra_rdoc_files: []
50
-
51
- files:
41
+ files:
52
42
  - MIT-LICENSE
53
43
  - bin/multi-timeout
54
44
  - lib/multi_timeout.rb
55
45
  - lib/multi_timeout/version.rb
56
46
  homepage: https://github.com/grosser/multi_timeout
57
- licenses:
47
+ licenses:
58
48
  - MIT
49
+ metadata: {}
59
50
  post_install_message:
60
51
  rdoc_options: []
61
-
62
- require_paths:
52
+ require_paths:
63
53
  - lib
64
- required_ruby_version: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- hash: 3
70
- segments:
71
- - 0
72
- version: "0"
73
- required_rubygems_version: !ruby/object:Gem::Requirement
74
- none: false
75
- requirements:
76
- - - ">="
77
- - !ruby/object:Gem::Version
78
- hash: 3
79
- segments:
80
- - 0
81
- version: "0"
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - '>='
57
+ - !ruby/object:Gem::Version
58
+ version: 1.9.3
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
82
64
  requirements: []
83
-
84
65
  rubyforge_project:
85
- rubygems_version: 1.8.20
66
+ rubygems_version: 2.0.14
86
67
  signing_key:
87
- specification_version: 3
68
+ specification_version: 4
88
69
  summary: Use multiple timeouts to soft and then hard kill a command
89
70
  test_files: []
90
-
metadata.gz.sig CHANGED
Binary file