masamune 0.18.7 → 0.18.8

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: e886df417cffdf88380ab29c2bf209f12ae2fa5e
4
- data.tar.gz: d94a89c271bd19c15d8a368e2e5a2e40a7def4e6
3
+ metadata.gz: 4998b7e77e19d79c880eee83917f6f16f764e6b3
4
+ data.tar.gz: 1b4a618c2981277813c470b8340b8e606767fd29
5
5
  SHA512:
6
- metadata.gz: c6b60f88135189d1bf95f88123f371f0f082fe7be93612e40ddf90d32c15e7b4a1cc76eb4a827164826c3cc66a73413192ea60af97ca94bf6eaa8c2aa7a3ce54
7
- data.tar.gz: 34c1cb0aa9a851f06157046a1f9de8f71b1d686e175d1bf9751353fe21a961e948a38e63071c872f360fa7982d72522580b7d49437a7c63cc6e55da9105cecff
6
+ metadata.gz: 630c9fe4a18665a88bc836b5f52930cbe6d3ceca3d4c30b26e9b2be51629383e8bf3b35fe56f96c3f947e444d0cea3b3014ceda3ab77afc095872d2fbf704127
7
+ data.tar.gz: d926af20492b4c945058d5e6be69d1ea998977f5d1fe13a7e2b29134152cb829dc1dfea56e634ac77bcfffc188e3c084fcb46322f1fae3190355e6bdae4a0383
@@ -47,8 +47,14 @@ module Masamune::Commands
47
47
  around_execute do
48
48
  pid = Process.fork
49
49
  if pid
50
- detach if opts.fetch(:detach, true)
51
- Process.waitpid(pid)
50
+ Signal.trap('INT') {} # Ensure SIGINT is handled by child process exec
51
+ if opts.fetch(:detach, true)
52
+ detach do
53
+ Process.waitpid(pid)
54
+ end
55
+ else
56
+ Process.waitpid(pid)
57
+ end
52
58
  exit
53
59
  else
54
60
  exec(command_env, *command_args)
@@ -143,7 +149,6 @@ module Masamune::Commands
143
149
 
144
150
  [t_stderr, t_stdout, t_stdin].compact.each(&:join)
145
151
  logger.debug("status: #{t_stdin.value}")
146
- `stty sane -F /dev/tty` if RUBY_PLATFORM =~ /linux/
147
152
  t_stdin.value
148
153
  end
149
154
  end
@@ -191,9 +196,33 @@ module Masamune::Commands
191
196
  end
192
197
 
193
198
  def detach
194
- STDIN.close
195
- STDOUT.close
196
- STDERR.close
199
+ old_stdin = $stdin.dup
200
+ new_stdin = File.open('/dev/null', 'r')
201
+ $stdin.reopen(new_stdin)
202
+ new_stdin.close
203
+
204
+ old_stdout = $stdout.dup
205
+ new_stdout = File.open('/dev/null', 'w+')
206
+ $stdout.reopen(new_stdout)
207
+ new_stdout.close
208
+
209
+ old_stderr = $stderr.dup
210
+ new_stderr = File.open('/dev/null', 'w+')
211
+ $stderr.reopen(new_stderr)
212
+ new_stderr.close
213
+
214
+ yield
215
+ ensure
216
+ $stdin.reopen(old_stdin)
217
+ old_stdin.close
218
+
219
+ $stdout.reopen(old_stdout)
220
+ old_stdout.close
221
+
222
+ $stderr.reopen(old_stderr)
223
+ old_stderr.close
224
+
225
+ `stty sane -F /dev/tty` if RUBY_PLATFORM =~ /linux/
197
226
  end
198
227
 
199
228
  def command_info
@@ -21,5 +21,5 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  module Masamune
24
- VERSION = '0.18.7'.freeze
24
+ VERSION = '0.18.8'.freeze
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: masamune
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.7
4
+ version: 0.18.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Andrews
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-17 00:00:00.000000000 Z
11
+ date: 2016-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor