Sha256: 5f6c831e32996ce0eba7f675ecd65f53ac791575c0296a2698b8504b2316977d
Contents?: true
Size: 593 Bytes
Versions: 16
Compression:
Stored size: 593 Bytes
Contents
require 'pty' require 'mkit/exceptions' module MKIt class CmdRunner def self.run(cmd) result='' begin shell = PTY.spawn( cmd ) begin shell[0].each { |line| result << line.strip! } rescue Errno::EIO # nothing ensure shell[0].close end shell[1].close Process.wait(shell[2]) rescue PTY::ChildExited # nothing end raise CmdRunnerException.new("command '#{cmd[0..30]}...' returned an error response") if !$?.nil? && $?.exitstatus != 0 result end end end
Version data entries
16 entries across 16 versions & 1 rubygems