dolzenko 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/dolzenko/shell_out.rb +10 -1
  2. metadata +2 -2
@@ -145,8 +145,10 @@ module ShellOut
145
145
  in_stream = ShellOut.getopt(:in, STDIN, *args)
146
146
  out_stream = ShellOut.getopt(:out, STDOUT, *args)
147
147
  writer = nil
148
+ spawned_pid = nil
148
149
  ShellOut.with_env(*args) do
149
150
  PTY.spawn(ShellOut.command(*args)) do |r_pty, w_pty, pid|
151
+ spawned_pid = pid
150
152
  reader = Thread.current
151
153
  writer = Thread.new do
152
154
  while true
@@ -187,7 +189,14 @@ module ShellOut
187
189
  rescue PTY::ChildExited => e
188
190
  return ShellOut::after(e.status.exitstatus, out_stream, *args)
189
191
  ensure
190
- writer && writer.kill
192
+ if writer
193
+ writer.kill rescue nil
194
+ end
195
+
196
+ if spawned_pid
197
+ Process.kill(-9, spawned_pid) rescue nil
198
+ end
199
+
191
200
  system "stty #{ old_state }"
192
201
  end
193
202
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 15
9
- version: 0.0.15
8
+ - 16
9
+ version: 0.0.16
10
10
  platform: ruby
11
11
  authors:
12
12
  - Evgeniy Dolzhenko