lib/rexec/connection.rb in rexec-1.4.0 vs lib/rexec/connection.rb in rexec-1.4.1
- old
+ new
@@ -37,21 +37,26 @@
# Create a new connection. You need to supply a pipe for reading input, a pipe for sending output,
# and optionally a pipe for errors to be read from.
def initialize(input, output, error = nil)
@input = input
@output = output
+
@running = true
+ @exceptions = :send
@error = error
@receive_mutex = Mutex.new
@send_mutex = Mutex.new
end
# The object that will handle remote proxy invocations.
attr :handler, true
+ # Whether to send exceptions across the wire, or handle normally (e.g. print to stdout):
+ attr :exceptions, true
+
# The proxy object that will dispatch RPCs.
attr :proxy
# The pipe used for reading data
def input
@@ -96,10 +101,14 @@
end
begin
yield object
rescue Exception => ex
- send_object(ex)
+ if @exceptions == :send
+ send_object(ex)
+ else
+ raise
+ end
end
end
end
end