pretty_multitask 0.1.13 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c91011fe61ca3de3b63eac1713c06ebad723117a06ebbbb9a3da8717a744f75
4
- data.tar.gz: a71e9b7a7985efddc58e236cebfd624f98375cd30b206eff12e6382ecc838dc0
3
+ metadata.gz: 5a34f7f0e4eb43047bef13821611cab3f100478e3c3eeec474f534efb74e24fb
4
+ data.tar.gz: 891b3c8b1a38b8073ad4dd345b2178bd8ef053e08ae7644f77728f6bb76bb4d6
5
5
  SHA512:
6
- metadata.gz: dcd6939ef5fc5435d458fc872fc96c3e248dfd8372e13d8e19c3394a76deeb3c1ea5f69dd0696e10a40d84c1300d8464ef9c6dfe0fc346bbda14f0546a34ce78
7
- data.tar.gz: a928da1e0d6661dc5bf46c6fad45c4d9c3201f561f86f8257938b2e4e023db9b21c0046f0f0c9c66efa386336e22eb8de92617f59ca2bc9ad7a228a5be32985c
6
+ metadata.gz: 4490a69312060f7e7f895ac4969cecfdd1ccee75768e2fe2a5b998c2090d53a6f6bbb5d7e7d4e992c675d70da2630ba5a6bbfc575419303955c325e7813f501b
7
+ data.tar.gz: 8432471383fa2f0153b1bdf5d861af192578bb1073a020f2e8eea61ce1adb1078084514947e157df4c1e8ccb311aa5331c61c09696a4512d6ef12ecdd9c8612f
@@ -3,6 +3,8 @@
3
3
  module PrettyMultitask
4
4
  # This class will run a callable, and wrap it's output adding nice format
5
5
  class RunCallable
6
+ LOGGER ||= Logger.new $stderr
7
+
6
8
  def initialize(opts = {})
7
9
  @opts = opts
8
10
  end
@@ -12,27 +14,28 @@ module PrettyMultitask
12
14
  name = opts[:name]
13
15
  out = STDOUT
14
16
  @padding = opts[:padding]
15
- master, slave = PTY.open
16
- err_read, err_write = IO.pipe
17
17
 
18
+
19
+ master_out, slave_out = PTY.open
20
+ master_err, slave_err = PTY.open
18
21
  r, w = UNIXSocket.pair(:STREAM, 0)
22
+ pid = run_on_fork(cmd, slave_err, slave_out, w)
19
23
 
20
- pid = run_on_fork(cmd, err_write, slave, w)
21
24
  Trapper.trap pid
22
25
 
23
- t_out = consume_and_print master, out, name, false
24
- t_err = consume_and_print err_read, out, name, true
26
+ t_out = consume_and_print master_out, out, name, false
27
+ t_err = consume_and_print master_err, out, name, true
25
28
 
26
29
  chars = []
27
30
  t = consume_and_store r, chars
28
31
 
29
32
  Process.wait pid
30
33
 
31
- wait_until_streams_are_ready [slave, err_read]
34
+ wait_until_streams_are_ready [slave_out, slave_err]
32
35
 
33
36
  join_threads [t_out, t_err, t]
34
37
 
35
- close_streams [master, slave, err_read, err_write]
38
+ close_streams [master_out, slave_out, master_err, slave_err]
36
39
 
37
40
  result = Marshal.load(chars.join)
38
41
  raise result[:error] if result[:error]
@@ -74,13 +77,15 @@ module PrettyMultitask
74
77
  pid = fork do
75
78
  STDERR.reopen err_w
76
79
  STDOUT.reopen out_w
80
+
77
81
  begin
78
82
  result = cmd.call
79
83
  obj = { result: result, error: nil }
80
84
  rescue StandardError => e
81
85
  new_error = e.class.new(e.message)
82
86
  new_error.set_backtrace e.backtrace
83
- Logger.new(STDERR).error new_error
87
+ LOGGER.reopen STDERR
88
+ LOGGER.error new_error
84
89
  obj = { result: nil, error: new_error }
85
90
  socket_w.puts Marshal.dump(obj), 0
86
91
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PrettyMultitask
4
- VERSION = '0.1.13'
4
+ VERSION = '0.1.15'
5
5
  end
@@ -36,5 +36,5 @@ Gem::Specification.new do |spec|
36
36
 
37
37
  spec.add_development_dependency 'bundler', '~> 2.1'
38
38
  spec.add_development_dependency 'minitest', '~> 5.0'
39
- spec.add_development_dependency 'rake', '~> 12.3.3'
39
+ spec.add_development_dependency 'rake', '~> 13.0'
40
40
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pretty_multitask
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Lopo Da Silva
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2021-10-09 00:00:00.000000000 Z
10
+ date: 2025-11-27 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: tlopo-executor
@@ -72,14 +71,14 @@ dependencies:
72
71
  requirements:
73
72
  - - "~>"
74
73
  - !ruby/object:Gem::Version
75
- version: 12.3.3
74
+ version: '13.0'
76
75
  type: :development
77
76
  prerelease: false
78
77
  version_requirements: !ruby/object:Gem::Requirement
79
78
  requirements:
80
79
  - - "~>"
81
80
  - !ruby/object:Gem::Version
82
- version: 12.3.3
81
+ version: '13.0'
83
82
  description: Multitask with pretty output for Rake
84
83
  email:
85
84
  - tiagolopo@yahoo.com.br
@@ -108,7 +107,6 @@ homepage: https://github.com/tlopo-ruby/tlopo-executor
108
107
  licenses:
109
108
  - MIT
110
109
  metadata: {}
111
- post_install_message:
112
110
  rdoc_options: []
113
111
  require_paths:
114
112
  - lib
@@ -123,8 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
121
  - !ruby/object:Gem::Version
124
122
  version: '0'
125
123
  requirements: []
126
- rubygems_version: 3.1.6
127
- signing_key:
124
+ rubygems_version: 3.6.2
128
125
  specification_version: 4
129
126
  summary: Multitask with pretty output for Rake
130
127
  test_files: []