Skip to content

Instantly share code, notes, and snippets.

@martinisoft
Created March 8, 2010 09:00
Show Gist options
  • Save martinisoft/325001 to your computer and use it in GitHub Desktop.
Save martinisoft/325001 to your computer and use it in GitHub Desktop.
require "pty"
require "expect"
STDOUT.sync = true
STDERR.sync = true
$expect_verbose = true
prompt_pat = %r/^[\s]{1}/
PTY.spawn("/home/martinisoft/srcds/orangebox/srcds_run -game tf +ip 192.168.1.8 +maxplayers 8 +map ctf_2fort") do |output, input, pid|
input.sync = true
output.expect(prompt_pat) do |output|
a = gets
input.print a
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment