diff options
author | Tim Moore <tmoore@incrementalism.net> | 2013-12-22 10:08:29 +1100 |
---|---|---|
committer | Tim Moore <tmoore@incrementalism.net> | 2013-12-22 10:08:29 +1100 |
commit | b17b335f6d316c556970e63889fd526e296939bf (patch) | |
tree | b97ae2e0b4842e52f4b7fdd2fe126e3265b48268 | |
parent | 55ac1810632bc3435f226710c33f3cdc7551b8cd (diff) | |
download | bundler-b17b335f6d316c556970e63889fd526e296939bf.tar.gz |
Cherry-pick erikhuda/thor@c06a272.
Fixes #2734 (non-atomic line endings in output).
-rw-r--r-- | lib/bundler/vendor/thor/shell/basic.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/bundler/vendor/thor/shell/basic.rb b/lib/bundler/vendor/thor/shell/basic.rb index d9119caeff..0ef50c8534 100644 --- a/lib/bundler/vendor/thor/shell/basic.rb +++ b/lib/bundler/vendor/thor/shell/basic.rb @@ -65,16 +65,13 @@ class Thor # def say(message="", color=nil, force_new_line=(message.to_s !~ /( |\t)\Z/)) message = message.to_s - message = set_color(message, *color) if color && can_display_colors? - spaces = " " * padding + buffer = " " * padding + buffer << message + buffer << "\n" if force_new_line && !message.end_with?("\n") - if force_new_line - stdout.puts(spaces + message) - else - stdout.print(spaces + message) - end + stdout.print(buffer) stdout.flush end @@ -91,7 +88,10 @@ class Thor status = status.to_s.rjust(12) status = set_color status, color, true if color - stdout.puts "#{status}#{spaces}#{message}" + buffer = "#{status}#{spaces}#{message}" + buffer << "\n" unless buffer.end_with?("\n") + + stdout.print(buffer) stdout.flush end |