Class: Overcommit::Subprocess
- Inherits:
-
Object
- Object
- Overcommit::Subprocess
- Defined in:
- lib/overcommit/subprocess.rb
Overview
Manages execution of a child process, collecting the exit status and standard out/error output.
Defined Under Namespace
Classes: Result
Class Method Summary collapse
-
.spawn(args) ⇒ Object
Spawns a new process using the given array of arguments (the first element is the command).
Class Method Details
.spawn(args) ⇒ Object
Spawns a new process using the given array of arguments (the first element is the command).
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/overcommit/subprocess.rb', line 18 def spawn(args) process = ChildProcess.build(*args) out, err = assign_output_streams(process) process.start process.wait err.rewind out.rewind Result.new(process.exit_code, out.read, err.read) end |