Sha256: 0a1f6ce05e3edd5d241c6b1a6ddeeee8257139f9010d630beb7caf976d91fc4d
Contents?: true
Size: 821 Bytes
Versions: 17
Compression:
Stored size: 821 Bytes
Contents
require 'socket' require 'sprout/fcsh_service' module Sprout #:nodoc class FCSHSocket def self.server(port=12321, out=nil) out = out || $stdout server = TCPServer.new(port) @fcsh = FCSHService.new(out) out.puts ">> fcsh started, waiting for connections on port #{port}" while(session = server.accept) response = @fcsh.execute(session.gets) session.puts(response) session.flush session.close end end def self.execute(command, port=12321) session = TCPSocket.new('localhost', port) session.puts(command) response = session.read error = response =~ /(.*Error:.*\^.*)\n/m if(error) raise FCSHError.new(response) end session.close return response end end end
Version data entries
17 entries across 17 versions & 1 rubygems