Class: Dploy::ShellCmd

Inherits:
Object
  • Object
show all
Defined in:
lib/dploy/shell_command.rb

Class Method Summary collapse

Class Method Details

.run(command, log) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/dploy/shell_command.rb', line 7

def self.run(command, log)
	PTY.spawn(command) do |output, input, pid|
		begin 
			while !PTY.check(pid)
				if log != nil
				  line = output.gets
				  if line.upcase.include? "ERROR"
					  log.error(line)
					else
					  log.debug(line)
					end
				end
			end
		rescue Errno::EIO
			puts "end"
		end
	end
end