Module: Execution
- Included in:
- Docker_Sync::WatchStrategy::Fswatch
- Defined in:
- lib/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 |
# File 'lib/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 |stdin, stdout, stderr, wait_thr| while lineOut = stdout.gets say_status prefix, lineOut, color end while lineErr = stderr.gets say_status prefix, lineErr, :red end end } end |