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

Inherits:
R10K::Util::Subprocess::Runner show all
Defined in:
lib/r10k/util/subprocess/runner/jruby.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 under JRuby.

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 R10K::Util::Subprocess::Runner

#cwd, #result

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ JRuby

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 JRuby.



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

def initialize(argv)
  @argv = argv
end

Instance Method Details

#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
# File 'lib/r10k/util/subprocess/runner/jruby.rb', line 16

def run
  spawn_opts = @cwd ? {:chdir => @cwd} : {}
  stdout, stderr, status = Open3.capture3(*@argv, spawn_opts)
  @result = R10K::Util::Subprocess::Result.new(@argv, stdout, stderr, status.exitstatus)
rescue Errno::ENOENT, Errno::EACCES => e
  @result = R10K::Util::Subprocess::Result.new(@argv, '', e.message, 255)
end