Top Level Namespace
Defined Under Namespace
Modules: Dry
Classes: Hash
Instance Method Summary
collapse
Instance Method Details
#exec_i(cmd, input_string = nil) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/dry-stack/command_line.rb', line 4
def exec_i(cmd, input_string = nil)
puts "exec_i(inputs.size #{input_string&.size}): #{cmd}"
Open3.popen3(cmd) do |i, o, e, wait_thr|
i.puts input_string unless input_string.nil?
i.close
while line = o.gets; puts "o: " + line end
while line = e.gets; puts "o: " + line end
return_value = wait_thr.value
puts "Error level was: #{return_value.exitstatus}" unless return_value.success?
exit return_value.exitstatus unless return_value.success?
end
end
|
#exec_o_lines(cmd) ⇒ Object
17
18
19
20
21
22
23
|
# File 'lib/dry-stack/command_line.rb', line 17
def exec_o_lines(cmd,&)
IO.popen(cmd, 'r') do |f|
f.each_line do |line|
yield line
end
end
end
|