This page contains automated test results for code from O'Reilly's Ruby Cookbook. If this code looks interesting or useful, you might want to buy the whole book.

Controlling MySQL on Unix
CodeExpectedActual
def mysql(opts, stream)
  IO.popen("mysql #{opts}", 'w') { |io| io.puts stream }
end
mysql '-u root -p[password]', <<-end
  drop database if exists website_db;
  create database website_db;
  grant all on website_db.* to #{`id -un`.strip}@localhost;
end
...
Errno::EPIPE: Broken pipe
	from (irb):2:in `write'
	from (irb):2:in `mysql'
	from (irb):2:in `mysql'
	from (irb):4