Class: Scriptster::ShellCmd

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
lib/scriptster/shellcmd.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logger

log, #log, set_file, set_script_name, set_time, set_verbosity, #tag

Constructor Details

#initialize(cmd, opts = {}) ⇒ ShellCmd

Returns a new instance of ShellCmd.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/scriptster/shellcmd.rb', line 34

def initialize(cmd, opts={})
  @out = ""
  @err = ""

  @show_out = false
  @show_err = true
  @raise_on_error = true
  @tag = "shell"
  @expect = 0

  opts.each do |k, v|
    self.instance_variable_set("@#{k.to_s}", v)
  end

  @cmd = cmd
  @status = nil

  run
end

Instance Attribute Details

#errObject (readonly)

Returns the value of attribute err.



30
31
32
# File 'lib/scriptster/shellcmd.rb', line 30

def err
  @err
end

#outObject (readonly)

Returns the value of attribute out.



30
31
32
# File 'lib/scriptster/shellcmd.rb', line 30

def out
  @out
end

#statusObject (readonly)

Returns the value of attribute status.



30
31
32
# File 'lib/scriptster/shellcmd.rb', line 30

def status
  @status
end