Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
*** cli_helper.rb 2012-02-08 20:01:17.520514397 +0900
--- cli_helper.rb.org 2012-02-08 19:49:11.137878140 +0900
***************
*** 62,79 ****
outbuf = stdout.read
errbuf = stderr.read
}
! begin
! GC.disable
! stat = Open4::popen4(cmd, &blk)
! if self.respond_to?(:logger)
! logger.debug("Exec command (pid=#{stat.pid}): #{cmd}")
! msg = "Command output:"
! msg << "\nSTDOUT:\n#{outbuf.strip}" if outbuf && outbuf.strip.size > 0
! msg << "\nSTDERR:\n#{errbuf.strip}" if errbuf && errbuf.strip.size > 0
! logger.debug(msg)
! end
! ensure
! GC.enable
end
if stat.exitstatus != opts[:expect_exitcode]
raise CommandError.new("Unexpected exit code=#{stat.exitstatus} (expected=#{opts[:expect_exitcode]})", \
--- 62,74 ----
outbuf = stdout.read
errbuf = stderr.read
}
! stat = Open4::popen4(cmd, &blk)
! if self.respond_to?(:logger)
! logger.debug("Exec command (pid=#{stat.pid}): #{cmd}")
! msg = "Command output:"
! msg << "\nSTDOUT:\n#{outbuf.strip}" if outbuf && outbuf.strip.size > 0
! msg << "\nSTDERR:\n#{errbuf.strip}" if errbuf && errbuf.strip.size > 0
! logger.debug(msg)
end
if stat.exitstatus != opts[:expect_exitcode]
raise CommandError.new("Unexpected exit code=#{stat.exitstatus} (expected=#{opts[:expect_exitcode]})", \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.