Class: Vectory::SystemCall

Inherits:
Object
  • Object
show all
Defined in:
lib/vectory/system_call.rb

Constant Summary collapse

TIMEOUT =
60

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cmd, timeout = TIMEOUT) ⇒ SystemCall

Returns a new instance of SystemCall.



10
11
12
13
# File 'lib/vectory/system_call.rb', line 10

def initialize(cmd, timeout = TIMEOUT)
  @cmd = cmd
  @timeout = timeout
end

Instance Attribute Details

#cmdObject (readonly)

Returns the value of attribute cmd.



8
9
10
# File 'lib/vectory/system_call.rb', line 8

def cmd
  @cmd
end

#statusObject (readonly)

Returns the value of attribute status.



8
9
10
# File 'lib/vectory/system_call.rb', line 8

def status
  @status
end

#stderrObject (readonly)

Returns the value of attribute stderr.



8
9
10
# File 'lib/vectory/system_call.rb', line 8

def stderr
  @stderr
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



8
9
10
# File 'lib/vectory/system_call.rb', line 8

def stdout
  @stdout
end

Instance Method Details

#callObject



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/vectory/system_call.rb', line 15

def call
  log_cmd(@cmd)

  execute(@cmd)

  log_result

  raise_error unless @status.success?

  self
end