Class: R10K::Util::Subprocess::Windows::Runner Private

Inherits:
Runner
  • Object
show all
Defined in:
lib/r10k/util/subprocess/windows/runner.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Run processes on Windows.

This implementation relies on Open3.capture3 to run commands and capture results. In contrast to the POSIX runner this cannot be used in an asynchronous manner as-is; implementing that will probably mean launching a thread and invoking #capture3 in that thread.

Instance Attribute Summary

Attributes inherited from Runner

#cwd, #io, #pid, #result, #status

Instance Method Summary collapse

Methods inherited from Runner

#start, #wait

Constructor Details

#initialize(argv) ⇒ Runner

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Runner.



11
12
13
14
# File 'lib/r10k/util/subprocess/windows/runner.rb', line 11

def initialize(argv)
  @argv = argv
  @io = R10K::Util::Subprocess::Windows::IO.new
end

Instance Method Details

#crashed?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


29
30
31
# File 'lib/r10k/util/subprocess/windows/runner.rb', line 29

def crashed?
  exit_code != 0
end

#exit_codeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
# File 'lib/r10k/util/subprocess/windows/runner.rb', line 25

def exit_code
  @status.exitstatus
end

#runObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
19
20
21
22
23
# File 'lib/r10k/util/subprocess/windows/runner.rb', line 16

def run
  cmd = @argv.join(' ')

  stdout, stderr, status = Open3.capture3(cmd)

  @status = status
  @result = R10K::Util::Subprocess::Result.new(@argv, stdout, stderr, status.exitstatus)
end