pretty_multitask 0.1.8 → 0.1.9

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
  SHA256:
3
- metadata.gz: a6d5c09df7c6d302bcb593e960369610d59fe42a0a30325138578e72d1cf8f9c
4
- data.tar.gz: 57162253ef143f8865477141490d0f1839920bdd70d36a95154c3938d79b06d5
3
+ metadata.gz: 3925750f68500c7985c8b7232c197d09b42eabf80d1d16f45cce3d8c7e99626b
4
+ data.tar.gz: 4bea26717393ed203c85d9116fe0e56e5d31e86bef474ea72940349ea028aaef
5
5
  SHA512:
6
- metadata.gz: 5c6c07f9165c2fa8add57d0647e64d936a915f54c4f09596f5a1160dcb46f1d537677124384d8f71021fb3f64cc0c85e255ffa8c63be7b25463ae83d3c60c4f9
7
- data.tar.gz: 85526699eaa75ab56932d9de650cc2eb46991a1449ad3e3872bb0f04fc7ef2b725b5ae85d45980cbe51adb773e45d7416352771bd82cc005f24808f8177e82c2
6
+ metadata.gz: b956e25b5c4d0c493da585214be1d56fe2f3da5691057c6a0955fb50a4ac8a4cf81764afabef786e8c326d6dbc6273235da027b4d46f480f62d94a6ed3e09973
7
+ data.tar.gz: 05e93b9eee198a1ec2a816fcbaac69bcdbf8ebbb9e402324d8cba26e0faf4a949afa8ee96e596c2e1b50ddf308f6978e0330ed31c095452adbc0b84962bca3ce
@@ -13,6 +13,7 @@ require 'fileutils'
13
13
 
14
14
  # Main module
15
15
  module PrettyMultitask
16
+ require "#{__dir__}/pretty_multitask/trapper"
16
17
  require "#{__dir__}/pretty_multitask/color"
17
18
  require "#{__dir__}/pretty_multitask/runner"
18
19
  require "#{__dir__}/pretty_multitask/run_callable"
@@ -18,6 +18,7 @@ module PrettyMultitask
18
18
  r, w = UNIXSocket.pair(:STREAM, 0)
19
19
 
20
20
  pid = run_on_fork(cmd, err_write, master, w)
21
+ Trapper.trap pid
21
22
 
22
23
  t_out = consume_and_print slave, out, name, false
23
24
  t_err = consume_and_print err_read, out, name, true
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PrettyMultitask
4
+ module Trapper
5
+ module_function
6
+
7
+ PIDS ||= Set.new
8
+ def trap(pid)
9
+ PIDS << pid
10
+ %w[SIGINT SIGTERM SIGHUP].each do |sig|
11
+ Signal.trap(sig) do
12
+ begin
13
+ PIDS.each { |pid| Process.kill sig, pid }
14
+ rescue Errno::ESRCH
15
+ nil
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PrettyMultitask
4
- VERSION = '0.1.8'
4
+ VERSION = '0.1.9'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pretty_multitask
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Lopo Da Silva
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-09 00:00:00.000000000 Z
11
+ date: 2020-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tlopo-executor
@@ -87,6 +87,7 @@ files:
87
87
  - lib/pretty_multitask/color.rb
88
88
  - lib/pretty_multitask/run_callable.rb
89
89
  - lib/pretty_multitask/runner.rb
90
+ - lib/pretty_multitask/trapper.rb
90
91
  - lib/pretty_multitask/version.rb
91
92
  - pretty_multitask.gemspec
92
93
  homepage: https://github.com/tlopo-ruby/tlopo-executor