Method: Indocker::Shell.command_with_result
- Defined in:
- lib/indocker/shell.rb
.command_with_result(command, logger, skip_logging: false) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/indocker/shell.rb', line 37 def command_with_result(command, logger, skip_logging: false) if !skip_logging && logger.debug? logger.debug("Executing command: #{command.cyan}") end result = nil IO.popen(command, err: [:child, :out]) do |io| result = io.read.chomp.strip if !skip_logging logger.debug(result) end end ShellResult.new(result, $?.exitstatus) end |