lib/rexec/server.rb in rexec-1.3.0 vs lib/rexec/server.rb in rexec-1.4.0

- old
+ new

@@ -70,26 +70,31 @@ # def self.start_server(code, command, options = {}, &block) options[:passthrough] = :err unless options[:passthrough] send_code = Proc.new do |cin| - cin.puts(CONNECTION_CODE) - cin.puts(CLIENT_CODE) + unless options[:raw] + cin.puts(CONNECTION_CODE) + cin.puts(CLIENT_CODE) + end + cin.puts(code) end if block_given? - Task.open(command, options) do |process| - conn = Connection.build(process, options, &send_code) + Task.open(command, options) do |task| + conn = Connection.build(task, options, &send_code) - yield conn, process.pid - + yield conn, task + conn.stop + task.stop + task.wait end else - process = Task.open(command, options) - conn = Connection.build(process, options, &send_code) + task = Task.open(command, options) + conn = Connection.build(task, options, &send_code) - return conn, process.pid + return conn, task end end end