Class: Terrapin::CommandLine::PosixRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/terrapin/command_line/runners/posix_runner.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.available?Boolean

Returns:

  • (Boolean)


6
7
8
9
10
# File 'lib/terrapin/command_line/runners/posix_runner.rb', line 6

def self.available?
  return @available unless @available.nil?

  @available = posix_spawn_gem_available?
end

.supported?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/terrapin/command_line/runners/posix_runner.rb', line 12

def self.supported?
  available? && !OS.java?
end

Instance Method Details

#call(command, env = {}, options = {}) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/terrapin/command_line/runners/posix_runner.rb', line 20

def call(command, env = {}, options = {})
  pipe = MultiPipe.new
  pid = spawn(env, command, options.merge(pipe.pipe_options))
  pipe.read_and_then do
    waitpid(pid)
  end
  pipe.output
end

#supported?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/terrapin/command_line/runners/posix_runner.rb', line 16

def supported?
  self.class.supported?
end