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

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

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.

Instance Attribute Summary collapse

Instance Method Summary collapse

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.



14
15
16
17
18
# File 'lib/r10k/util/subprocess/runner.rb', line 14

def initialize(argv)
  @argv = argv

  @io = R10K::Util::Subprocess::IO.new
end

Instance Attribute Details

#cwdObject

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.



6
7
8
# File 'lib/r10k/util/subprocess/runner.rb', line 6

def cwd
  @cwd
end

#ioObject (readonly)

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.



8
9
10
# File 'lib/r10k/util/subprocess/runner.rb', line 8

def io
  @io
end

#pidObject (readonly)

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.



10
11
12
# File 'lib/r10k/util/subprocess/runner.rb', line 10

def pid
  @pid
end

#statusObject (readonly)

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.



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

def status
  @status
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)


38
39
40
# File 'lib/r10k/util/subprocess/runner.rb', line 38

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.



42
43
44
# File 'lib/r10k/util/subprocess/runner.rb', line 42

def exit_code
  @status.exitstatus
end

#startObject

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.



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/r10k/util/subprocess/runner.rb', line 20

def start
  exec_r, exec_w = status_pipe()

  @pid = fork do
    exec_r.close
    execute_child(exec_w)
  end

  exec_w.close
  execute_parent(exec_r)
end

#waitObject

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.



32
33
34
35
36
# File 'lib/r10k/util/subprocess/runner.rb', line 32

def wait
  if @pid
    _, @status = Process.waitpid2(@pid)
  end
end