Skip to content

Instantly share code, notes, and snippets.

@purp
Created September 22, 2009 01:56
Show Gist options
  • Save purp/190726 to your computer and use it in GitHub Desktop.
Save purp/190726 to your computer and use it in GitHub Desktop.
# cucumber/features/support/env.rb lines 83-96
def run(command)
stderr_file = Tempfile.new('cucumber')
stderr_file.close
in_current_dir do
@last_stdout = `#{command} 2> #{stderr_file.path}`
mode = Cucumber::RUBY_1_9 ? {:external_encoding=>"UTF-8"} : 'r'
IO.popen("#{command} 2> #{stderr_file.path}", mode) do |io|
@last_stdout = io.read
end
@last_exit_status = $?.exitstatus
end
@last_stderr = IO.read(stderr_file.path)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment