Class: Pike::SSH::Process

Inherits:
Object
  • Object
show all
Defined in:
lib/pike/ssh/process.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command) ⇒ Process

Returns a new instance of Process.



10
11
12
13
14
15
# File 'lib/pike/ssh/process.rb', line 10

def initialize(command)
  @stdout = ''
  @stderr = ''
  @exit_code = 0
  @command = command
end

Instance Attribute Details

#commandObject

Returns the value of attribute command.



7
8
9
# File 'lib/pike/ssh/process.rb', line 7

def command
  @command
end

#exit_codeObject

Returns the value of attribute exit_code.



6
7
8
# File 'lib/pike/ssh/process.rb', line 6

def exit_code
  @exit_code
end

#stderrObject

Returns the value of attribute stderr.



5
6
7
# File 'lib/pike/ssh/process.rb', line 5

def stderr
  @stderr
end

#stdoutObject

Returns the value of attribute stdout.



4
5
6
# File 'lib/pike/ssh/process.rb', line 4

def stdout
  @stdout
end

Instance Method Details

#on_exit_status(channel, data) ⇒ Object



17
18
19
# File 'lib/pike/ssh/process.rb', line 17

def on_exit_status(channel, data)
  @exit_code = data.read_long
end

#on_stderr(channel, type, data) ⇒ Object



21
22
23
# File 'lib/pike/ssh/process.rb', line 21

def on_stderr(channel, type, data)
  @stderr << data
end

#on_stdout(channel, data) ⇒ Object



25
26
27
# File 'lib/pike/ssh/process.rb', line 25

def on_stdout(channel, data)
  @stdout << data
end

#success?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/pike/ssh/process.rb', line 29

def success?
  exit_code == 0
end