qbash 0.4.4 → 0.4.6
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/Gemfile +5 -5
- data/Gemfile.lock +69 -62
- data/REUSE.toml +1 -0
- data/lib/qbash.rb +29 -23
- data/qbash.gemspec +3 -3
- metadata +3 -22
- data/.0pdd.yml +0 -8
- data/.gitattributes +0 -7
- data/.github/workflows/actionlint.yml +0 -25
- data/.github/workflows/codecov.yml +0 -25
- data/.github/workflows/copyrights.yml +0 -19
- data/.github/workflows/markdown-lint.yml +0 -23
- data/.github/workflows/pdd.yml +0 -19
- data/.github/workflows/rake.yml +0 -28
- data/.github/workflows/reuse.yml +0 -19
- data/.github/workflows/typos.yml +0 -19
- data/.github/workflows/xcop.yml +0 -19
- data/.github/workflows/yamllint.yml +0 -19
- data/.gitignore +0 -13
- data/.pdd +0 -7
- data/.rubocop.yml +0 -52
- data/.rultor.yml +0 -26
- data/renovate.json +0 -6
- data/test/test__helper.rb +0 -31
- data/test/test_qbash.rb +0 -144
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 82c7e31d5dacedf2c9404dca242f7983bf04c70e784454c5930895f6b27d53b6
|
|
4
|
+
data.tar.gz: 21340fe8ac7609a80d34d57e5e47658336bb7d0f094f5d1c5773d3e447b5cbfc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c979a339e3b9a15ec37ef0cbca27c9d673b9aeb33ad05a1d39c8c410b0b4510f417d12358f798f6a5a48ec81a24eb1df994d612305289ec0ad0133a6ef61d398
|
|
7
|
+
data.tar.gz: 135b0f98ddbab247eb0689d6166bf93358e9eee3ab4f60bce6500f197a031eb48f01b195d0cc23f5bc1f3eab281e574dbbdcf34df868886b3ea8e46a03225fee
|
data/Gemfile
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
source 'https://rubygems.org'
|
|
7
7
|
gemspec
|
|
8
8
|
|
|
9
|
-
gem 'cucumber', '~>
|
|
9
|
+
gem 'cucumber', '~>10.0', require: false
|
|
10
10
|
gem 'minitest', '~>5.25', require: false
|
|
11
11
|
gem 'minitest-reporters', '~>1.7', require: false
|
|
12
12
|
gem 'net-ping', '~>2.0', require: false
|
|
@@ -14,11 +14,11 @@ gem 'rake', '~>13.2', require: false
|
|
|
14
14
|
gem 'random-port', '~>0.0', require: false
|
|
15
15
|
gem 'rdoc', '~>6.13', require: false
|
|
16
16
|
gem 'rubocop', '~>1.73', require: false
|
|
17
|
-
gem 'rubocop-minitest', '
|
|
18
|
-
gem 'rubocop-performance', '
|
|
19
|
-
gem 'rubocop-rake', '
|
|
17
|
+
gem 'rubocop-minitest', '~>0.38', require: false
|
|
18
|
+
gem 'rubocop-performance', '~>1.25', require: false
|
|
19
|
+
gem 'rubocop-rake', '~>0.7', require: false
|
|
20
20
|
gem 'simplecov', '~>0.22', require: false
|
|
21
|
-
gem 'simplecov-cobertura', '~>
|
|
21
|
+
gem 'simplecov-cobertura', '~>3.0', require: false
|
|
22
22
|
gem 'w3c_validators', '~>1.3', require: false
|
|
23
23
|
gem 'webmock', '~>3.25', require: false
|
|
24
24
|
gem 'yard', '~>0.9', require: false
|
data/Gemfile.lock
CHANGED
|
@@ -14,43 +14,45 @@ GEM
|
|
|
14
14
|
public_suffix (>= 2.0.2, < 7.0)
|
|
15
15
|
ansi (1.5.0)
|
|
16
16
|
ast (2.4.3)
|
|
17
|
-
backtrace (0.4.
|
|
18
|
-
|
|
17
|
+
backtrace (0.4.1)
|
|
18
|
+
base64 (0.3.0)
|
|
19
|
+
bigdecimal (3.3.1)
|
|
19
20
|
builder (3.3.0)
|
|
20
|
-
crack (1.0.
|
|
21
|
+
crack (1.0.1)
|
|
21
22
|
bigdecimal
|
|
22
23
|
rexml
|
|
23
|
-
cucumber (
|
|
24
|
+
cucumber (10.1.1)
|
|
25
|
+
base64 (~> 0.2)
|
|
24
26
|
builder (~> 3.2)
|
|
25
27
|
cucumber-ci-environment (> 9, < 11)
|
|
26
|
-
cucumber-core (>
|
|
27
|
-
cucumber-cucumber-expressions (
|
|
28
|
-
cucumber-gherkin (> 24, < 28)
|
|
28
|
+
cucumber-core (> 15, < 17)
|
|
29
|
+
cucumber-cucumber-expressions (> 17, < 19)
|
|
29
30
|
cucumber-html-formatter (> 20.3, < 22)
|
|
30
|
-
cucumber-messages (> 19, < 25)
|
|
31
31
|
diff-lcs (~> 1.5)
|
|
32
|
+
logger (~> 1.6)
|
|
32
33
|
mini_mime (~> 1.1)
|
|
33
34
|
multi_test (~> 1.1)
|
|
34
|
-
sys-uname (~> 1.
|
|
35
|
+
sys-uname (~> 1.3)
|
|
35
36
|
cucumber-ci-environment (10.0.1)
|
|
36
|
-
cucumber-core (
|
|
37
|
-
cucumber-gherkin (
|
|
38
|
-
cucumber-messages (
|
|
39
|
-
cucumber-tag-expressions (> 5, <
|
|
40
|
-
cucumber-cucumber-expressions (
|
|
37
|
+
cucumber-core (15.3.0)
|
|
38
|
+
cucumber-gherkin (> 27, < 35)
|
|
39
|
+
cucumber-messages (> 26, < 30)
|
|
40
|
+
cucumber-tag-expressions (> 5, < 9)
|
|
41
|
+
cucumber-cucumber-expressions (18.0.1)
|
|
41
42
|
bigdecimal
|
|
42
|
-
cucumber-gherkin (
|
|
43
|
-
cucumber-messages (
|
|
44
|
-
cucumber-html-formatter (21.
|
|
43
|
+
cucumber-gherkin (34.0.0)
|
|
44
|
+
cucumber-messages (> 25, < 29)
|
|
45
|
+
cucumber-html-formatter (21.15.1)
|
|
45
46
|
cucumber-messages (> 19, < 28)
|
|
46
|
-
cucumber-messages (
|
|
47
|
-
cucumber-tag-expressions (
|
|
47
|
+
cucumber-messages (27.2.0)
|
|
48
|
+
cucumber-tag-expressions (8.0.0)
|
|
48
49
|
date (3.4.1)
|
|
49
|
-
diff-lcs (1.6.
|
|
50
|
+
diff-lcs (1.6.2)
|
|
50
51
|
docile (1.4.1)
|
|
51
|
-
elapsed (0.0
|
|
52
|
-
loog (
|
|
53
|
-
tago (
|
|
52
|
+
elapsed (0.2.0)
|
|
53
|
+
loog (~> 0.6)
|
|
54
|
+
tago (~> 0.1)
|
|
55
|
+
erb (5.1.1)
|
|
54
56
|
ffi (1.17.2-aarch64-linux-gnu)
|
|
55
57
|
ffi (1.17.2-arm-linux-gnu)
|
|
56
58
|
ffi (1.17.2-arm64-darwin)
|
|
@@ -58,16 +60,17 @@ GEM
|
|
|
58
60
|
ffi (1.17.2-x86-linux-gnu)
|
|
59
61
|
ffi (1.17.2-x86_64-darwin)
|
|
60
62
|
ffi (1.17.2-x86_64-linux-gnu)
|
|
61
|
-
hashdiff (1.1
|
|
62
|
-
json (2.
|
|
63
|
-
language_server-protocol (3.17.0.
|
|
63
|
+
hashdiff (1.2.1)
|
|
64
|
+
json (2.15.1)
|
|
65
|
+
language_server-protocol (3.17.0.5)
|
|
64
66
|
lint_roller (1.1.0)
|
|
65
67
|
logger (1.7.0)
|
|
66
68
|
loog (0.6.1)
|
|
67
69
|
logger (~> 1.0)
|
|
70
|
+
memoist3 (1.0.0)
|
|
68
71
|
mini_mime (1.1.5)
|
|
69
|
-
mini_portile2 (2.8.
|
|
70
|
-
minitest (5.
|
|
72
|
+
mini_portile2 (2.8.9)
|
|
73
|
+
minitest (5.26.0)
|
|
71
74
|
minitest-reporters (1.7.1)
|
|
72
75
|
ansi
|
|
73
76
|
builder
|
|
@@ -75,40 +78,42 @@ GEM
|
|
|
75
78
|
ruby-progressbar
|
|
76
79
|
multi_test (1.1.0)
|
|
77
80
|
net-ping (2.0.8)
|
|
78
|
-
nokogiri (1.18.
|
|
81
|
+
nokogiri (1.18.10)
|
|
79
82
|
mini_portile2 (~> 2.8.2)
|
|
80
83
|
racc (~> 1.4)
|
|
81
|
-
nokogiri (1.18.
|
|
84
|
+
nokogiri (1.18.10-aarch64-linux-gnu)
|
|
82
85
|
racc (~> 1.4)
|
|
83
|
-
nokogiri (1.18.
|
|
86
|
+
nokogiri (1.18.10-arm-linux-gnu)
|
|
84
87
|
racc (~> 1.4)
|
|
85
|
-
nokogiri (1.18.
|
|
88
|
+
nokogiri (1.18.10-arm64-darwin)
|
|
86
89
|
racc (~> 1.4)
|
|
87
|
-
nokogiri (1.18.
|
|
90
|
+
nokogiri (1.18.10-x64-mingw-ucrt)
|
|
88
91
|
racc (~> 1.4)
|
|
89
|
-
nokogiri (1.18.
|
|
92
|
+
nokogiri (1.18.10-x86_64-darwin)
|
|
90
93
|
racc (~> 1.4)
|
|
91
|
-
nokogiri (1.18.
|
|
94
|
+
nokogiri (1.18.10-x86_64-linux-gnu)
|
|
92
95
|
racc (~> 1.4)
|
|
93
96
|
parallel (1.27.0)
|
|
94
|
-
parser (3.3.
|
|
97
|
+
parser (3.3.9.0)
|
|
95
98
|
ast (~> 2.4.1)
|
|
96
99
|
racc
|
|
97
|
-
prism (1.
|
|
98
|
-
psych (5.2.
|
|
100
|
+
prism (1.6.0)
|
|
101
|
+
psych (5.2.6)
|
|
99
102
|
date
|
|
100
103
|
stringio
|
|
101
104
|
public_suffix (6.0.2)
|
|
102
105
|
racc (1.8.1)
|
|
103
106
|
rainbow (3.1.1)
|
|
104
|
-
rake (13.
|
|
105
|
-
random-port (0.7.
|
|
106
|
-
tago (
|
|
107
|
-
rdoc (6.
|
|
107
|
+
rake (13.3.0)
|
|
108
|
+
random-port (0.7.6)
|
|
109
|
+
tago (~> 0.0)
|
|
110
|
+
rdoc (6.15.0)
|
|
111
|
+
erb
|
|
108
112
|
psych (>= 4.0.0)
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
113
|
+
tsort
|
|
114
|
+
regexp_parser (2.11.3)
|
|
115
|
+
rexml (3.4.4)
|
|
116
|
+
rubocop (1.81.6)
|
|
112
117
|
json (~> 2.3)
|
|
113
118
|
language_server-protocol (~> 3.17.0.2)
|
|
114
119
|
lint_roller (~> 1.1.0)
|
|
@@ -116,20 +121,20 @@ GEM
|
|
|
116
121
|
parser (>= 3.3.0.2)
|
|
117
122
|
rainbow (>= 2.2.2, < 4.0)
|
|
118
123
|
regexp_parser (>= 2.9.3, < 3.0)
|
|
119
|
-
rubocop-ast (>= 1.
|
|
124
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
120
125
|
ruby-progressbar (~> 1.7)
|
|
121
126
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
122
|
-
rubocop-ast (1.
|
|
127
|
+
rubocop-ast (1.47.1)
|
|
123
128
|
parser (>= 3.3.7.2)
|
|
124
129
|
prism (~> 1.4)
|
|
125
|
-
rubocop-minitest (0.38.
|
|
130
|
+
rubocop-minitest (0.38.2)
|
|
126
131
|
lint_roller (~> 1.1)
|
|
127
132
|
rubocop (>= 1.75.0, < 2.0)
|
|
128
133
|
rubocop-ast (>= 1.38.0, < 2.0)
|
|
129
|
-
rubocop-performance (1.
|
|
134
|
+
rubocop-performance (1.26.1)
|
|
130
135
|
lint_roller (~> 1.1)
|
|
131
136
|
rubocop (>= 1.75.0, < 2.0)
|
|
132
|
-
rubocop-ast (>= 1.
|
|
137
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
133
138
|
rubocop-rake (0.7.1)
|
|
134
139
|
lint_roller (~> 1.1)
|
|
135
140
|
rubocop (>= 1.72.1)
|
|
@@ -138,18 +143,20 @@ GEM
|
|
|
138
143
|
docile (~> 1.1)
|
|
139
144
|
simplecov-html (~> 0.11)
|
|
140
145
|
simplecov_json_formatter (~> 0.1)
|
|
141
|
-
simplecov-cobertura (
|
|
146
|
+
simplecov-cobertura (3.1.0)
|
|
142
147
|
rexml
|
|
143
148
|
simplecov (~> 0.19)
|
|
144
|
-
simplecov-html (0.13.
|
|
149
|
+
simplecov-html (0.13.2)
|
|
145
150
|
simplecov_json_formatter (0.1.4)
|
|
146
151
|
stringio (3.1.7)
|
|
147
|
-
sys-uname (1.
|
|
152
|
+
sys-uname (1.4.1)
|
|
148
153
|
ffi (~> 1.1)
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
unicode-
|
|
154
|
+
memoist3 (~> 1.0.0)
|
|
155
|
+
tago (0.3.0)
|
|
156
|
+
tsort (0.2.0)
|
|
157
|
+
unicode-display_width (3.2.0)
|
|
158
|
+
unicode-emoji (~> 4.1)
|
|
159
|
+
unicode-emoji (4.1.0)
|
|
153
160
|
w3c_validators (1.3.7)
|
|
154
161
|
json (>= 1.8)
|
|
155
162
|
nokogiri (~> 1.6)
|
|
@@ -171,7 +178,7 @@ PLATFORMS
|
|
|
171
178
|
x86_64-linux
|
|
172
179
|
|
|
173
180
|
DEPENDENCIES
|
|
174
|
-
cucumber (~>
|
|
181
|
+
cucumber (~> 10.0)
|
|
175
182
|
minitest (~> 5.25)
|
|
176
183
|
minitest-reporters (~> 1.7)
|
|
177
184
|
net-ping (~> 2.0)
|
|
@@ -180,11 +187,11 @@ DEPENDENCIES
|
|
|
180
187
|
random-port (~> 0.0)
|
|
181
188
|
rdoc (~> 6.13)
|
|
182
189
|
rubocop (~> 1.73)
|
|
183
|
-
rubocop-minitest (
|
|
184
|
-
rubocop-performance (
|
|
185
|
-
rubocop-rake (
|
|
190
|
+
rubocop-minitest (~> 0.38)
|
|
191
|
+
rubocop-performance (~> 1.25)
|
|
192
|
+
rubocop-rake (~> 0.7)
|
|
186
193
|
simplecov (~> 0.22)
|
|
187
|
-
simplecov-cobertura (~>
|
|
194
|
+
simplecov-cobertura (~> 3.0)
|
|
188
195
|
w3c_validators (~> 1.3)
|
|
189
196
|
webmock (~> 3.25)
|
|
190
197
|
yard (~> 0.9)
|
data/REUSE.toml
CHANGED
data/lib/qbash.rb
CHANGED
|
@@ -7,7 +7,6 @@ require 'backtrace'
|
|
|
7
7
|
require 'logger'
|
|
8
8
|
require 'loog'
|
|
9
9
|
require 'open3'
|
|
10
|
-
require 'shellwords'
|
|
11
10
|
require 'tago'
|
|
12
11
|
|
|
13
12
|
# Execute one bash command.
|
|
@@ -75,17 +74,19 @@ module Kernel
|
|
|
75
74
|
#
|
|
76
75
|
# @param [String, Array] cmd The command to run (String or Array of arguments)
|
|
77
76
|
# @param [String] stdin The +stdin+ to provide to the command
|
|
77
|
+
# @param [Array] opts List of bash options, like "--login" and "--noprofile"
|
|
78
78
|
# @param [Hash] env Hash of environment variables
|
|
79
79
|
# @param [Loog|IO] log Logging facility with +.debug()+ method (or +$stdout+, or nil if should go to +/dev/null+)
|
|
80
80
|
# @param [Array] accept List of accepted exit codes (accepts all if the list is +nil+)
|
|
81
81
|
# @param [Boolean] both If set to TRUE, the function returns an array +(stdout, code)+
|
|
82
82
|
# @param [Integer] level Logging level (use +Logger::DEBUG+, +Logger::INFO+, +Logger::WARN+, or +Logger::ERROR+)
|
|
83
83
|
# @return [String] Everything that was printed to the +stdout+ by the command
|
|
84
|
-
def qbash(cmd, stdin: '', env: {}, log: Loog::NULL, accept: [0], both: false, level: Logger::DEBUG)
|
|
84
|
+
def qbash(cmd, opts: [], stdin: '', env: {}, log: Loog::NULL, accept: [0], both: false, level: Logger::DEBUG)
|
|
85
85
|
env.each { |k, v| raise "env[#{k}] is nil" if v.nil? }
|
|
86
86
|
cmd = cmd.reject { |a| a.nil? || (a.is_a?(String) && a.empty?) }.join(' ') if cmd.is_a?(Array)
|
|
87
87
|
logit =
|
|
88
88
|
lambda do |msg|
|
|
89
|
+
msg = msg.gsub(/\n$/, '')
|
|
89
90
|
mtd =
|
|
90
91
|
case level
|
|
91
92
|
when Logger::DEBUG
|
|
@@ -104,19 +105,22 @@ module Kernel
|
|
|
104
105
|
elsif log.respond_to?(mtd)
|
|
105
106
|
log.__send__(mtd, msg)
|
|
106
107
|
else
|
|
107
|
-
log.print(msg)
|
|
108
|
+
log.print("#{msg}\n")
|
|
108
109
|
end
|
|
109
110
|
end
|
|
110
|
-
logit["+ #{cmd}"]
|
|
111
111
|
buf = ''
|
|
112
112
|
e = 1
|
|
113
113
|
start = Time.now
|
|
114
|
-
|
|
114
|
+
bash = ['/bin/bash'] + opts + ['-c', cmd]
|
|
115
|
+
Open3.popen2e(env, *bash) do |sin, sout, ctrl|
|
|
116
|
+
pid = ctrl.pid
|
|
117
|
+
logit["+ #{cmd} /##{pid}"]
|
|
115
118
|
consume =
|
|
116
119
|
lambda do
|
|
117
120
|
loop do
|
|
118
|
-
|
|
119
|
-
|
|
121
|
+
sleep 0.001
|
|
122
|
+
break if sout.closed? || sout.eof?
|
|
123
|
+
ln = sout.gets # together with the \n at the end
|
|
120
124
|
next if ln.nil?
|
|
121
125
|
next if ln.empty?
|
|
122
126
|
buf += ln
|
|
@@ -132,22 +136,24 @@ module Kernel
|
|
|
132
136
|
if block_given?
|
|
133
137
|
watch = Thread.new { consume.call }
|
|
134
138
|
watch.abort_on_exception = true
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
139
|
+
begin
|
|
140
|
+
yield pid
|
|
141
|
+
ensure
|
|
142
|
+
sout.close
|
|
143
|
+
watch.join(0.01)
|
|
144
|
+
watch.kill if watch.alive?
|
|
145
|
+
attempt = 1
|
|
146
|
+
since = Time.now
|
|
147
|
+
loop do
|
|
148
|
+
Process.kill(0, pid) # should be dead already (raising Errno::ESRCH)
|
|
149
|
+
Process.kill('TERM', pid) # let's try to kill it
|
|
150
|
+
logit["Tried to stop ##{pid} with SIGTERM (attempt no.#{attempt}, #{since.ago}): #{cmd}"]
|
|
151
|
+
sleep(0.1)
|
|
152
|
+
attempt += 1
|
|
153
|
+
rescue Errno::ESRCH
|
|
154
|
+
logit["Process ##{pid} reacted to SIGTERM, after #{attempt} attempts and #{since.ago}"] if attempt > 1
|
|
155
|
+
break
|
|
156
|
+
end
|
|
151
157
|
end
|
|
152
158
|
else
|
|
153
159
|
consume.call
|
data/qbash.gemspec
CHANGED
|
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
|
9
9
|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
|
10
10
|
s.required_ruby_version = '>=3.2'
|
|
11
11
|
s.name = 'qbash'
|
|
12
|
-
s.version = '0.4.
|
|
12
|
+
s.version = '0.4.6'
|
|
13
13
|
s.license = 'MIT'
|
|
14
14
|
s.summary = 'Quick Executor of a BASH Command'
|
|
15
15
|
s.description =
|
|
@@ -17,8 +17,8 @@ Gem::Specification.new do |s|
|
|
|
17
17
|
'returns its output and exit code'
|
|
18
18
|
s.authors = ['Yegor Bugayenko']
|
|
19
19
|
s.email = 'yegor256@gmail.com'
|
|
20
|
-
s.homepage = '
|
|
21
|
-
s.files = `git ls-files`.split($RS)
|
|
20
|
+
s.homepage = 'https://github.com/yegor256/qbash'
|
|
21
|
+
s.files = `git ls-files | grep -v -E '^(test/|\\.|renovate)'`.split($RS)
|
|
22
22
|
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
23
23
|
s.rdoc_options = ['--charset=UTF-8']
|
|
24
24
|
s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: qbash
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yegor Bugayenko
|
|
@@ -74,22 +74,6 @@ extra_rdoc_files:
|
|
|
74
74
|
- LICENSE.txt
|
|
75
75
|
- README.md
|
|
76
76
|
files:
|
|
77
|
-
- ".0pdd.yml"
|
|
78
|
-
- ".gitattributes"
|
|
79
|
-
- ".github/workflows/actionlint.yml"
|
|
80
|
-
- ".github/workflows/codecov.yml"
|
|
81
|
-
- ".github/workflows/copyrights.yml"
|
|
82
|
-
- ".github/workflows/markdown-lint.yml"
|
|
83
|
-
- ".github/workflows/pdd.yml"
|
|
84
|
-
- ".github/workflows/rake.yml"
|
|
85
|
-
- ".github/workflows/reuse.yml"
|
|
86
|
-
- ".github/workflows/typos.yml"
|
|
87
|
-
- ".github/workflows/xcop.yml"
|
|
88
|
-
- ".github/workflows/yamllint.yml"
|
|
89
|
-
- ".gitignore"
|
|
90
|
-
- ".pdd"
|
|
91
|
-
- ".rubocop.yml"
|
|
92
|
-
- ".rultor.yml"
|
|
93
77
|
- Gemfile
|
|
94
78
|
- Gemfile.lock
|
|
95
79
|
- LICENSE.txt
|
|
@@ -99,10 +83,7 @@ files:
|
|
|
99
83
|
- Rakefile
|
|
100
84
|
- lib/qbash.rb
|
|
101
85
|
- qbash.gemspec
|
|
102
|
-
|
|
103
|
-
- test/test__helper.rb
|
|
104
|
-
- test/test_qbash.rb
|
|
105
|
-
homepage: http://github.com/yegor256/qbash
|
|
86
|
+
homepage: https://github.com/yegor256/qbash
|
|
106
87
|
licenses:
|
|
107
88
|
- MIT
|
|
108
89
|
metadata:
|
|
@@ -122,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
122
103
|
- !ruby/object:Gem::Version
|
|
123
104
|
version: '0'
|
|
124
105
|
requirements: []
|
|
125
|
-
rubygems_version: 3.6.
|
|
106
|
+
rubygems_version: 3.6.9
|
|
126
107
|
specification_version: 4
|
|
127
108
|
summary: Quick Executor of a BASH Command
|
|
128
109
|
test_files: []
|
data/.0pdd.yml
DELETED
data/.gitattributes
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
name: actionlint
|
|
6
|
-
'on':
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- master
|
|
10
|
-
pull_request:
|
|
11
|
-
branches:
|
|
12
|
-
- master
|
|
13
|
-
jobs:
|
|
14
|
-
actionlint:
|
|
15
|
-
timeout-minutes: 15
|
|
16
|
-
runs-on: ubuntu-24.04
|
|
17
|
-
steps:
|
|
18
|
-
- uses: actions/checkout@v4
|
|
19
|
-
- name: Download actionlint
|
|
20
|
-
id: get_actionlint
|
|
21
|
-
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
|
|
22
|
-
shell: bash
|
|
23
|
-
- name: Check workflow files
|
|
24
|
-
run: ${{ steps.get_actionlint.outputs.executable }} -color
|
|
25
|
-
shell: bash
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
name: codecov
|
|
6
|
-
'on':
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- master
|
|
10
|
-
jobs:
|
|
11
|
-
codecov:
|
|
12
|
-
timeout-minutes: 15
|
|
13
|
-
runs-on: ubuntu-24.04
|
|
14
|
-
steps:
|
|
15
|
-
- uses: actions/checkout@v4
|
|
16
|
-
- uses: ruby/setup-ruby@v1
|
|
17
|
-
with:
|
|
18
|
-
ruby-version: 3.3
|
|
19
|
-
bundler-cache: true
|
|
20
|
-
- run: bundle config set --global path "$(pwd)/vendor/bundle"
|
|
21
|
-
- run: bundle install --no-color
|
|
22
|
-
- run: bundle exec rake
|
|
23
|
-
- uses: codecov/codecov-action@v5
|
|
24
|
-
with:
|
|
25
|
-
token: ${{ secrets.CODECOV_TOKEN }}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
name: copyrights
|
|
6
|
-
'on':
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- master
|
|
10
|
-
pull_request:
|
|
11
|
-
branches:
|
|
12
|
-
- master
|
|
13
|
-
jobs:
|
|
14
|
-
copyrights:
|
|
15
|
-
timeout-minutes: 15
|
|
16
|
-
runs-on: ubuntu-24.04
|
|
17
|
-
steps:
|
|
18
|
-
- uses: actions/checkout@v4
|
|
19
|
-
- uses: yegor256/copyrights-action@0.0.8
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
name: markdown-lint
|
|
6
|
-
'on':
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- master
|
|
10
|
-
pull_request:
|
|
11
|
-
branches:
|
|
12
|
-
- master
|
|
13
|
-
paths-ignore: ['paper/**', 'sandbox/**']
|
|
14
|
-
concurrency:
|
|
15
|
-
group: markdown-lint-${{ github.ref }}
|
|
16
|
-
cancel-in-progress: true
|
|
17
|
-
jobs:
|
|
18
|
-
markdown-lint:
|
|
19
|
-
timeout-minutes: 15
|
|
20
|
-
runs-on: ubuntu-24.04
|
|
21
|
-
steps:
|
|
22
|
-
- uses: actions/checkout@v4
|
|
23
|
-
- uses: articulate/actions-markdownlint@v1
|
data/.github/workflows/pdd.yml
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
name: pdd
|
|
6
|
-
'on':
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- master
|
|
10
|
-
pull_request:
|
|
11
|
-
branches:
|
|
12
|
-
- master
|
|
13
|
-
jobs:
|
|
14
|
-
pdd:
|
|
15
|
-
timeout-minutes: 15
|
|
16
|
-
runs-on: ubuntu-24.04
|
|
17
|
-
steps:
|
|
18
|
-
- uses: actions/checkout@v4
|
|
19
|
-
- uses: volodya-lombrozo/pdd-action@master
|
data/.github/workflows/rake.yml
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
name: rake
|
|
6
|
-
'on':
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- master
|
|
10
|
-
pull_request:
|
|
11
|
-
branches:
|
|
12
|
-
- master
|
|
13
|
-
jobs:
|
|
14
|
-
rake:
|
|
15
|
-
strategy:
|
|
16
|
-
matrix:
|
|
17
|
-
os: [ubuntu-24.04, macos-15]
|
|
18
|
-
ruby: [3.3]
|
|
19
|
-
runs-on: ${{ matrix.os }}
|
|
20
|
-
steps:
|
|
21
|
-
- uses: actions/checkout@v4
|
|
22
|
-
- uses: ruby/setup-ruby@v1
|
|
23
|
-
with:
|
|
24
|
-
ruby-version: ${{ matrix.ruby }}
|
|
25
|
-
bundler-cache: true
|
|
26
|
-
- run: bundle config set --global path "$(pwd)/vendor/bundle"
|
|
27
|
-
- run: bundle install --no-color
|
|
28
|
-
- run: bundle exec rake
|
data/.github/workflows/reuse.yml
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
name: reuse
|
|
6
|
-
'on':
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- master
|
|
10
|
-
pull_request:
|
|
11
|
-
branches:
|
|
12
|
-
- master
|
|
13
|
-
jobs:
|
|
14
|
-
reuse:
|
|
15
|
-
timeout-minutes: 15
|
|
16
|
-
runs-on: ubuntu-24.04
|
|
17
|
-
steps:
|
|
18
|
-
- uses: actions/checkout@v4
|
|
19
|
-
- uses: fsfe/reuse-action@v5
|
data/.github/workflows/typos.yml
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
name: typos
|
|
6
|
-
'on':
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- master
|
|
10
|
-
pull_request:
|
|
11
|
-
branches:
|
|
12
|
-
- master
|
|
13
|
-
jobs:
|
|
14
|
-
typos:
|
|
15
|
-
timeout-minutes: 15
|
|
16
|
-
runs-on: ubuntu-24.04
|
|
17
|
-
steps:
|
|
18
|
-
- uses: actions/checkout@v4
|
|
19
|
-
- uses: crate-ci/typos@v1.32.0
|
data/.github/workflows/xcop.yml
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
name: xcop
|
|
6
|
-
'on':
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- master
|
|
10
|
-
pull_request:
|
|
11
|
-
branches:
|
|
12
|
-
- master
|
|
13
|
-
jobs:
|
|
14
|
-
xcop:
|
|
15
|
-
timeout-minutes: 15
|
|
16
|
-
runs-on: ubuntu-24.04
|
|
17
|
-
steps:
|
|
18
|
-
- uses: actions/checkout@v4
|
|
19
|
-
- uses: g4s8/xcop-action@master
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
name: yamllint
|
|
6
|
-
'on':
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- master
|
|
10
|
-
pull_request:
|
|
11
|
-
branches:
|
|
12
|
-
- master
|
|
13
|
-
jobs:
|
|
14
|
-
yamllint:
|
|
15
|
-
timeout-minutes: 15
|
|
16
|
-
runs-on: ubuntu-24.04
|
|
17
|
-
steps:
|
|
18
|
-
- uses: actions/checkout@v4
|
|
19
|
-
- uses: ibiqlik/action-yamllint@v3
|
data/.gitignore
DELETED
data/.pdd
DELETED
data/.rubocop.yml
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
AllCops:
|
|
5
|
-
Exclude:
|
|
6
|
-
- 'bin/**/*'
|
|
7
|
-
- 'assets/**/*'
|
|
8
|
-
- 'vendor/**/*'
|
|
9
|
-
DisplayCopNames: true
|
|
10
|
-
TargetRubyVersion: 3.2
|
|
11
|
-
SuggestExtensions: false
|
|
12
|
-
NewCops: enable
|
|
13
|
-
plugins:
|
|
14
|
-
- rubocop-minitest
|
|
15
|
-
- rubocop-performance
|
|
16
|
-
- rubocop-rake
|
|
17
|
-
Minitest/EmptyLineBeforeAssertionMethods:
|
|
18
|
-
Enabled: false
|
|
19
|
-
Metrics/ParameterLists:
|
|
20
|
-
Enabled: false
|
|
21
|
-
Style/GlobalVars:
|
|
22
|
-
Enabled: false
|
|
23
|
-
Metrics/MethodLength:
|
|
24
|
-
Enabled: false
|
|
25
|
-
Gemspec/RequiredRubyVersion:
|
|
26
|
-
Enabled: false
|
|
27
|
-
Style/ClassAndModuleChildren:
|
|
28
|
-
Enabled: false
|
|
29
|
-
Layout/MultilineMethodCallIndentation:
|
|
30
|
-
Enabled: false
|
|
31
|
-
Metrics/AbcSize:
|
|
32
|
-
Enabled: false
|
|
33
|
-
Metrics/ClassLength:
|
|
34
|
-
Enabled: false
|
|
35
|
-
Metrics/BlockLength:
|
|
36
|
-
Enabled: false
|
|
37
|
-
Metrics/CyclomaticComplexity:
|
|
38
|
-
Enabled: false
|
|
39
|
-
Metrics/PerceivedComplexity:
|
|
40
|
-
Enabled: false
|
|
41
|
-
Layout/EmptyLineAfterGuardClause:
|
|
42
|
-
Enabled: false
|
|
43
|
-
Layout/CaseIndentation:
|
|
44
|
-
Enabled: false
|
|
45
|
-
Naming/MethodParameterName:
|
|
46
|
-
MinNameLength: 2
|
|
47
|
-
Layout/EndOfLine:
|
|
48
|
-
EnforcedStyle: lf
|
|
49
|
-
Layout/MultilineAssignmentLayout:
|
|
50
|
-
Enabled: true
|
|
51
|
-
Layout/FirstHashElementIndentation:
|
|
52
|
-
EnforcedStyle: consistent
|
data/.rultor.yml
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
docker:
|
|
6
|
-
image: yegor256/ruby
|
|
7
|
-
assets:
|
|
8
|
-
rubygems.yml: yegor256/home#assets/rubygems.yml
|
|
9
|
-
install: |
|
|
10
|
-
pdd -f /dev/null
|
|
11
|
-
bundle install --no-color
|
|
12
|
-
release:
|
|
13
|
-
pre: false
|
|
14
|
-
script: |-
|
|
15
|
-
[[ "${tag}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit -1
|
|
16
|
-
bundle exec rake
|
|
17
|
-
rm -rf *.gem
|
|
18
|
-
sed -i "s/0\.0\.0/${tag}/g" qbash.gemspec
|
|
19
|
-
git add qbash.gemspec
|
|
20
|
-
git commit -m "version set to ${tag}"
|
|
21
|
-
gem build qbash.gemspec
|
|
22
|
-
chmod 0600 ../rubygems.yml
|
|
23
|
-
gem push *.gem --config-file ../rubygems.yml
|
|
24
|
-
merge:
|
|
25
|
-
script: |-
|
|
26
|
-
bundle exec rake
|
data/renovate.json
DELETED
data/test/test__helper.rb
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
4
|
-
# SPDX-License-Identifier: MIT
|
|
5
|
-
|
|
6
|
-
$stdout.sync = true
|
|
7
|
-
|
|
8
|
-
require 'simplecov'
|
|
9
|
-
require 'simplecov-cobertura'
|
|
10
|
-
unless SimpleCov.running || ENV['PICKS']
|
|
11
|
-
SimpleCov.command_name('test')
|
|
12
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
|
|
13
|
-
[
|
|
14
|
-
SimpleCov::Formatter::HTMLFormatter,
|
|
15
|
-
SimpleCov::Formatter::CoberturaFormatter
|
|
16
|
-
]
|
|
17
|
-
)
|
|
18
|
-
SimpleCov.minimum_coverage 95
|
|
19
|
-
SimpleCov.minimum_coverage_by_file 95
|
|
20
|
-
SimpleCov.start do
|
|
21
|
-
add_filter 'test/'
|
|
22
|
-
add_filter 'vendor/'
|
|
23
|
-
add_filter 'target/'
|
|
24
|
-
track_files 'lib/**/*.rb'
|
|
25
|
-
track_files '*.rb'
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
require 'minitest/autorun'
|
|
30
|
-
require 'minitest/reporters'
|
|
31
|
-
Minitest::Reporters.use! [Minitest::Reporters::SpecReporter.new]
|
data/test/test_qbash.rb
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
4
|
-
# SPDX-License-Identifier: MIT
|
|
5
|
-
|
|
6
|
-
require 'minitest/autorun'
|
|
7
|
-
require 'tmpdir'
|
|
8
|
-
require 'loog'
|
|
9
|
-
require 'logger'
|
|
10
|
-
require 'shellwords'
|
|
11
|
-
require_relative 'test__helper'
|
|
12
|
-
require_relative '../lib/qbash'
|
|
13
|
-
|
|
14
|
-
# Test.
|
|
15
|
-
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
16
|
-
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
17
|
-
# License:: MIT
|
|
18
|
-
class TestQbash < Minitest::Test
|
|
19
|
-
def test_basic_run
|
|
20
|
-
Dir.mktmpdir do |home|
|
|
21
|
-
qbash("cd #{Shellwords.escape(home)}; echo $FOO | cat > a.txt", env: { 'FOO' => '42' })
|
|
22
|
-
assert_path_exists(File.join(home, 'a.txt'))
|
|
23
|
-
assert_equal("42\n", File.read(File.join(home, 'a.txt')))
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def test_command_as_array
|
|
28
|
-
assert_equal('123', qbash(['printf 1;', 'printf 2;', 'printf', 3]))
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def test_log_to_console
|
|
32
|
-
qbash('echo Hello world!', log: $stdout)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def test_log_to_loog
|
|
36
|
-
[Logger::DEBUG, Logger::INFO, Logger::WARN, Logger::ERROR].each do |level|
|
|
37
|
-
qbash('echo Hello world!', log: Loog::NULL, level:)
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def test_skip_nil
|
|
42
|
-
assert_equal('Hi!', qbash(['printf', nil, 'Hi!', '']))
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def test_log_to_nil
|
|
46
|
-
assert_equal("yes\n", qbash('echo yes', log: nil))
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def test_accept_zero
|
|
50
|
-
qbash('echo hi', accept: nil)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def test_with_stdin
|
|
54
|
-
Dir.mktmpdir do |home|
|
|
55
|
-
f = File.join(home, 'a b c.txt')
|
|
56
|
-
qbash("cat > #{Shellwords.escape(f)}", stdin: 'hello')
|
|
57
|
-
assert_path_exists(f)
|
|
58
|
-
assert_equal('hello', File.read(f))
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
def test_with_special_symbols
|
|
63
|
-
assert_equal("'hi'\n", qbash("echo \"'hi'\""))
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def test_with_error
|
|
67
|
-
Dir.mktmpdir do |home|
|
|
68
|
-
assert_raises(StandardError) { qbash("cat #{Shellwords.escape(File.join(home, 'b.txt'))}") }
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
def test_fails_when_nil_env
|
|
73
|
-
assert_raises(StandardError) { qbash('echo hi', env: { a: nil }) }
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def test_ignore_errors
|
|
77
|
-
Dir.mktmpdir do |home|
|
|
78
|
-
qbash("cat #{Shellwords.escape(File.join(home, 'b.txt'))}", accept: nil)
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
def test_kills_in_thread
|
|
83
|
-
Thread.new do
|
|
84
|
-
qbash('sleep 9999', accept: nil) do |pid|
|
|
85
|
-
Process.kill('KILL', pid)
|
|
86
|
-
end
|
|
87
|
-
end.join
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
def test_logs_in_background
|
|
91
|
-
stdout = nil
|
|
92
|
-
buf = Loog::Buffer.new
|
|
93
|
-
Dir.mktmpdir do |home|
|
|
94
|
-
flag = File.join(home, 'started.txt')
|
|
95
|
-
cmd = "while true; do date; touch #{Shellwords.escape(flag)}; sleep 0.001; done"
|
|
96
|
-
Thread.new do
|
|
97
|
-
stdout =
|
|
98
|
-
qbash(cmd, log: buf, accept: nil) do |pid|
|
|
99
|
-
loop { break if File.exist?(flag) }
|
|
100
|
-
Process.kill('KILL', pid)
|
|
101
|
-
end
|
|
102
|
-
end.join
|
|
103
|
-
end
|
|
104
|
-
refute_empty(buf.to_s)
|
|
105
|
-
refute_empty(stdout)
|
|
106
|
-
refute_includes(stdout, "\n\n")
|
|
107
|
-
refute_includes(buf.to_s, "\n\n")
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
def test_logs_multi_line_print
|
|
111
|
-
buf = Loog::Buffer.new
|
|
112
|
-
pid = nil
|
|
113
|
-
qbash('echo one; echo two', log: buf, accept: nil) do |i|
|
|
114
|
-
sleep(0.1)
|
|
115
|
-
pid = i
|
|
116
|
-
end
|
|
117
|
-
assert_equal(buf.to_s, "+ echo one; echo two\n##{pid}: one\n##{pid}: two\n")
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
def test_with_both
|
|
121
|
-
Dir.mktmpdir do |home|
|
|
122
|
-
stdout, code = qbash("cat #{Shellwords.escape(File.join(home, 'foo.txt'))}", accept: nil, both: true)
|
|
123
|
-
assert_predicate(code, :positive?)
|
|
124
|
-
refute_empty(stdout)
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
def test_exists_after_background_stop
|
|
129
|
-
stop = false
|
|
130
|
-
pid = nil
|
|
131
|
-
t =
|
|
132
|
-
Thread.new do
|
|
133
|
-
qbash('trap "" TERM; sleep 10', accept: nil) do |id|
|
|
134
|
-
pid = id
|
|
135
|
-
loop { break if stop }
|
|
136
|
-
end
|
|
137
|
-
end
|
|
138
|
-
t.abort_on_exception = true
|
|
139
|
-
sleep(0.01)
|
|
140
|
-
stop = true
|
|
141
|
-
refute(t.join(0.1))
|
|
142
|
-
t.kill
|
|
143
|
-
end
|
|
144
|
-
end
|