Sha256: f06202e9d6c31833feb90c5515fd4e34fab706411b2d926d8e32cd145af072fd
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
require 'ogre' module Ogre # wrapper to assist aruba in single process execution class Runner def initialize(argv, stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel) @argv = argv @stdin = stdin @stdout = stdout @stderr = stderr @kernel = kernel end def execute! exit_code = begin $stderr = @stderr $stdin = @stdin $stdout = @stdout Ogre::CLI.start(@argv) # Thor::Base#start does not have a return value # assume success if no exception is raised. 0 rescue StandardError => err # The ruby interpreter would pipe this to STDERR and # exit 1 in the case of an unhandled exception b = err.backtrace b.unshift("#{b.shift}: #{err.message} (#{err.class})") @stderr.puts(b.map { |s| "\tfrom #{s}" }.join("\n")) 1 ensure # put them back. $stderr = STDERR $stdin = STDIN $stdout = STDOUT end # Proxy exit code back to the injected kernel. @kernel.exit(exit_code) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ogre-0.1.7 | lib/ogre/runner.rb |
ogre-0.1.6 | lib/ogre/runner.rb |
ogre-0.1.5 | lib/ogre/runner.rb |