Use Ruby's PTY library to avoid hard coded PTYs. While we're add it, make this a ruby script.