From 667c82996971dbfcb8a44c648aa8ee6a3eb504d8 Mon Sep 17 00:00:00 2001 From: Sven Fuchs Date: Sat, 1 Aug 2009 18:03:17 +0200 Subject: [PATCH] Make app template git adapter sync back output immediately. A little background - when I asked Eleanor McHugh about this she replied: "Backtick and %x{} are intended to be used as replacement expressions: the command is executed in a subshell and then the entire output of that command is returned as the value of the backtick expression. Under the hood backtick is implemented by creating a pipe and using that to capture the STDOUT of the command, reading that into a buffer until the command completes and the pipe closes and because backtick uses a pipe that's concealed within the interpreter there's no way to directly access its STDOUT stream. For this particular use case the combination of system() and STDOUT.sync should be safe." --- .../generators/applications/app/scm/git.rb | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/railties/lib/rails_generator/generators/applications/app/scm/git.rb b/railties/lib/rails_generator/generators/applications/app/scm/git.rb index 445de6a..a53494d 100644 --- a/railties/lib/rails_generator/generators/applications/app/scm/git.rb +++ b/railties/lib/rails_generator/generators/applications/app/scm/git.rb @@ -1,16 +1,18 @@ +STDOUT.sync = true + module Rails class Git < Scm def self.clone(repos, branch=nil) - `git clone #{repos}` + system "git clone #{repos}" if branch - `cd #{repos.split('/').last}/` - `git checkout #{branch}` + system "cd #{repos.split('/').last}/" + system "git checkout #{branch}" end end def self.run(command) - `git #{command}` + system "git #{command}" end end end \ No newline at end of file -- 1.6.0.5