Skip to content

Instantly share code, notes, and snippets.

@blatyo
Created June 2, 2014 19:13
Show Gist options
  • Save blatyo/8ec60e78f58daf55d432 to your computer and use it in GitHub Desktop.
Save blatyo/8ec60e78f58daf55d432 to your computer and use it in GitHub Desktop.
execute and exit on failure
def execute(command, logger)
require 'open3'
_, stdout, stderr, process = Open3.popen3(command)
unless process.value.success?
logger.error(command)
logger.error(stdout.read)
logger.error(stderr.read)
exit process.value.exitstatus
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment