From 861910b85fd1521b14b0c40ec1013b229d1061ff Mon Sep 17 00:00:00 2001 From: Baptiste Fontaine Date: Wed, 20 Jan 2016 00:29:14 +0100 Subject: [PATCH] sh: flush stdout before executing the shell Closes Homebrew/homebrew#48268. Signed-off-by: Baptiste Fontaine --- Library/Homebrew/cmd/sh.rb | 1 + Library/Homebrew/test/test_integration_cmds.rb | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/Library/Homebrew/cmd/sh.rb b/Library/Homebrew/cmd/sh.rb index bc09d48508..5ada75ab25 100644 --- a/Library/Homebrew/cmd/sh.rb +++ b/Library/Homebrew/cmd/sh.rb @@ -24,6 +24,7 @@ module Homebrew ignore our configuration. When done, type `exit'. EOS + $stdout.flush exec ENV["SHELL"] end end diff --git a/Library/Homebrew/test/test_integration_cmds.rb b/Library/Homebrew/test/test_integration_cmds.rb index eaab307b66..47a288d719 100644 --- a/Library/Homebrew/test/test_integration_cmds.rb +++ b/Library/Homebrew/test/test_integration_cmds.rb @@ -284,6 +284,11 @@ class IntegrationCommandTests < Homebrew::TestCase (HOMEBREW_REPOSITORY/".git").unlink end + def test_sh + assert_match "Your shell has been configured", + cmd("sh", {"SHELL" => "/usr/bin/true"}) + end + def test_custom_command mktmpdir do |path| cmd = "int-test-#{rand}"