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 +4 -4
- data/lib/pretty_multitask/run_callable.rb +13 -8
- data/lib/pretty_multitask/version.rb +1 -1
- data/pretty_multitask.gemspec +1 -1
- metadata +5 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5a34f7f0e4eb43047bef13821611cab3f100478e3c3eeec474f534efb74e24fb
|
|
4
|
+
data.tar.gz: 891b3c8b1a38b8073ad4dd345b2178bd8ef053e08ae7644f77728f6bb76bb4d6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|
24
|
-
t_err = consume_and_print
|
|
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 [
|
|
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 [
|
|
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
|
-
|
|
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
|
data/pretty_multitask.gemspec
CHANGED
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.
|
|
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:
|
|
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:
|
|
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:
|
|
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.
|
|
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: []
|