Class: Dr::ShellCmd

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logger

#log, log, set_logfile, set_verbosity, #tag

Constructor Details

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

Returns a new instance of ShellCmd.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/dr/shellcmd.rb', line 15

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

  @show_out = false
  @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.



11
12
13
# File 'lib/dr/shellcmd.rb', line 11

def err
  @err
end

#outObject (readonly)

Returns the value of attribute out.



11
12
13
# File 'lib/dr/shellcmd.rb', line 11

def out
  @out
end

#statusObject (readonly)

Returns the value of attribute status.



11
12
13
# File 'lib/dr/shellcmd.rb', line 11

def status
  @status
end