module Acouchi class ProcessLauncher def initialize(*arguments) @arguments = arguments @process = ChildProcess.build(*@arguments) @process.io.inherit! end def start write_out_arguments @process.start @process.wait end def start_in_background write_out_arguments @process.start end def stop @process.stop end def start_and_crash_if_process_fails start if @process.crashed? raise "A process exited with a non-zero exit code.\nThe command executed was \"#{@arguments.join(" ")}\"" end end private def write_out_arguments p @arguments end end end