7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/dploy/shell_command.rb', line 7
def self.run(command, log = nil)
error_found = false
PTY.spawn(command) do |output, input, pid|
begin
while result = !PTY.check(pid)
if log != nil
line = output.gets
if line.upcase.include? "ERROR"
log.error(line)
error_found = true
else
log.debug(line)
end
end
end
rescue Errno::EIO
end
puts "*" * 200 if error_found || $?.exitstatus != 0 if $? != nil
raise "command: #{command} failed!" if error_found || $?.exitstatus != 0 if $? != nil
end
end
|