Last active
December 12, 2015 05:08
-
-
Save jonleighton/4718873 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
diff --git a/lib/spring/application.rb b/lib/spring/application.rb | |
index 6e241a8..c726a24 100644 | |
--- a/lib/spring/application.rb | |
+++ b/lib/spring/application.rb | |
@@ -20,11 +20,11 @@ module Spring | |
@watcher = watcher | |
@setup = Set.new | |
- @stdout = IO.new(STDOUT.fileno) | |
- @stderr = IO.new(STDERR.fileno) | |
- @stdin = File.open('/dev/null', 'r') | |
+ # @stdout = IO.new(STDOUT.fileno) | |
+ # @stderr = IO.new(STDERR.fileno) | |
+ # @stdin = File.open('/dev/null', 'r') | |
- STDIN.reopen(@stdin) | |
+ # STDIN.reopen(@stdin) | |
end | |
def start | |
@@ -61,7 +61,11 @@ module Spring | |
end | |
def serve(client) | |
- redirect_output(client) do | |
+ #redirect_output(client) do | |
+ stdout = client.recv_io | |
+ stderr = client.recv_io | |
+ stdin = client.recv_io | |
+ | |
args_length = client.gets.to_i | |
args = args_length.times.map { client.read(client.gets.to_i) } | |
command = Spring.command(args.shift) | |
@@ -72,13 +76,19 @@ module Spring | |
ActionDispatch::Reloader.prepare! | |
pid = fork { | |
+ Process.setsid | |
+ | |
+ STDOUT.reopen(stdout) | |
+ STDERR.reopen(stderr) | |
+ STDIN.reopen(stdin) | |
+ | |
IGNORE_SIGNALS.each { |sig| trap(sig, "DEFAULT") } | |
command.call(args) | |
} | |
manager.puts pid | |
Process.wait pid | |
- end | |
+ #end | |
ensure | |
client.puts | |
client.close | |
diff --git a/lib/spring/client/run.rb b/lib/spring/client/run.rb | |
index b3ee0ac..791cdbf 100644 | |
--- a/lib/spring/client/run.rb | |
+++ b/lib/spring/client/run.rb | |
@@ -30,7 +30,8 @@ module Spring | |
application.send_io STDOUT | |
application.send_io STDERR | |
- application.send_io stdin_slave | |
+ application.send_io STDIN | |
+ # application.send_io stdin_slave | |
application.puts args.length | |
diff --git a/lib/spring/commands.rb b/lib/spring/commands.rb | |
index 5527296..03ce5a9 100644 | |
--- a/lib/spring/commands.rb | |
+++ b/lib/spring/commands.rb | |
@@ -94,11 +94,8 @@ module Spring | |
Spring.register_command "rake", Rake.new | |
class Console | |
- def setup | |
- require "rails/commands/console" | |
- end | |
- | |
def call(args) | |
+ require "rails/commands/console" | |
ARGV.replace args | |
::Rails::Console.start(::Rails.application) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment