Created
February 8, 2012 10:55
-
-
Save debility-zz/1768177 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** 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