Class: ShellCommandWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/app_fog/shell_command_wrapper.rb

Instance Method Summary collapse

Constructor Details

#initialize(open3 = Open3) ⇒ ShellCommandWrapper

Returns a new instance of ShellCommandWrapper.



4
5
6
# File 'lib/app_fog/shell_command_wrapper.rb', line 4

def initialize(open3 = Open3)
	@open3 = open3
end

Instance Method Details

#perform(command) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/app_fog/shell_command_wrapper.rb', line 8

def perform(command)
	stdin, stdout, stderr = @open3.popen3 command
	output = stdout.read unless stdout == nil

	puts output

	if (output != nil && output.include?('Problem with login, invalid account or password when attempting to login to'))
		raise LoginError.new(output)
	end
end