Class: Nand::Launcher::ShellLauncher

Inherits:
Base show all
Defined in:
lib/nand/launcher/shell_launcher.rb

Direct Known Subclasses

ExecutableFileLauncher

Instance Attribute Summary

Attributes inherited from Base

#execname

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize, #ready?

Constructor Details

This class inherits a constructor from Nand::Launcher::Base

Class Method Details

.launchable?(target, io, opts) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
14
15
# File 'lib/nand/launcher/shell_launcher.rb', line 8

def self.launchable?(target, io, opts)
  require 'mkmf'
  raise "Not Executable #{target}" if find_executable0(target).nil?
  true
rescue => e
  io.puts "\t- " + e.message
  false
end

.load(target, opts = {}, *argv) ⇒ Object



16
17
18
# File 'lib/nand/launcher/shell_launcher.rb', line 16

def self.load(target, opts = {}, *argv)
  new(target, opts, *argv)
end

Instance Method Details

#cmdObject



19
# File 'lib/nand/launcher/shell_launcher.rb', line 19

def cmd; "#{@progname} #{@argv.join(" ")}" end

#launchObject



20
21
22
# File 'lib/nand/launcher/shell_launcher.rb', line 20

def launch
  spawn("#{cmd}", :out => @exec_stdout, :err => @exec_stderr, :in => @exec_stdin, :pgroup => true)
end