Module: Execution
- Defined in:
- lib/docker-sync/execution.rb
Instance Method Summary collapse
Instance Method Details
#threadexec(command, prefix = nil, color = nil) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/docker-sync/execution.rb', line 8 def threadexec(command, prefix = nil, color = nil) if prefix.nil? # TODO: probably pick the command name without args prefix = 'unknown' end if color.nil? color = :cyan end Thread.new { Open3.popen3(command) do |_, stdout, stderr, _| # noinspection RubyAssignmentExpressionInConditionalInspection while line_out = stdout.gets say_status prefix, line_out, color end # noinspection RubyAssignmentExpressionInConditionalInspection while line_err = stderr.gets say_status prefix, line_err, :red end end } end |