lib/rbbt/util/cmd.rb in rbbt-util-1.1.0 vs lib/rbbt/util/cmd.rb in rbbt-util-1.2.1
- old
+ new
@@ -1,20 +1,21 @@
require 'rbbt/util/misc'
require 'rbbt/util/log'
require 'stringio'
module CMD
- class CMDError < RBBTError;end
+ class CMDError < RBBTError; end
module SmartIO
def self.tie(io, pid = nil, cmd = "", post = nil)
io.instance_eval{
@pid = pid
@cmd = cmd
@post = post
alias original_close close
def close
begin
+ self.original_read unless self.closed? or self.eof?
Process.waitpid(@pid) if @pid
rescue
end
if $? and not $?.success?