Created
January 1, 2013 15:21
-
-
Save senny/4428103 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
diff --git a/lib/spring.rb b/lib/spring.rb | |
index 38a22bf..20669c6 100644 | |
--- a/lib/spring.rb | |
+++ b/lib/spring.rb | |
@@ -50,6 +50,7 @@ class Spring | |
end | |
def run(args) | |
+ puts "#run" | |
boot_server unless server_running? | |
application, client = UNIXSocket.pair | |
@@ -58,12 +59,25 @@ class Spring | |
server.send_io client | |
server.write rails_env_for(args.first) | |
server.close | |
+ puts "SERVER closed" | |
client.close | |
+ puts "CLIENT closed" | |
+ puts "SENDING STDOUT" | |
application.send_io STDOUT | |
+ puts "STDOUT sent" | |
+ application.read(1) | |
+ | |
+ puts "SENDING STDERR" | |
application.send_io STDERR | |
+ puts "STDERR sent" | |
+ application.read(1) | |
+ | |
+ puts "SENDING STDIN" | |
application.send_io stdin_slave | |
+ puts "STDIN sent" | |
+ application.read(1) | |
application.puts args.length | |
diff --git a/lib/spring/application.rb b/lib/spring/application.rb | |
index 301423f..43c9620 100644 | |
--- a/lib/spring/application.rb | |
+++ b/lib/spring/application.rb | |
@@ -91,9 +91,20 @@ class Spring | |
end | |
def redirect_output(socket) | |
+ puts "RECEIVING: STDOUT" | |
STDOUT.reopen socket.recv_io | |
+ puts "STDOUT received" | |
+ socket.write "." | |
+ | |
+ puts "RECEIVING: STDERR" | |
STDERR.reopen socket.recv_io | |
- STDIN.reopen socket.recv_io | |
+ puts "STDERR received" | |
+ socket.write "." | |
+ | |
+ puts "RECEIVING: STDIN" | |
+ STDIN.reopen socket.recv_io | |
+ puts "STDIN received" | |
+ socket.write "." | |
yield | |
ensure |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment