require 'open3' require_relative '../lib/xcbootstrap' include XCBootstrap def run_command cmd stdin, stdout, stderr, wait_thr = Open3.popen3(cmd) return wait_thr.value.success?, stdout.read end def capture_stdout(&block) original_stdout = $stdout $stdout = fake = StringIO.new begin yield ensure $stdout = original_stdout end fake.string end