aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharlie Sharpsteen2012-09-24 16:34:29 -0500
committerCharlie Sharpsteen2012-09-24 16:34:29 -0500
commit0019042efdc2cbfedd2e7bd5f311166ac70c5b88 (patch)
tree42da81cc50f2514e5ca7d38f52ebb23474ea45d5
parent5608ad6dae59a3e2bcf45ee705a37ec20cd8e290 (diff)
downloadhomebrew-0019042efdc2cbfedd2e7bd5f311166ac70c5b88.tar.bz2
Notify user of how to abort installation
Notify users that hitting any key other than ENTER will abort the installer.
-rw-r--r--install16
1 files changed, 9 insertions, 7 deletions
diff --git a/install b/install
index 2749d99dc..29ac17761 100644
--- a/install
+++ b/install
@@ -55,6 +55,14 @@ ensure
system "/bin/stty -raw echo"
end
+def wait_for_user
+ puts
+ puts "Press ENTER to continue or any other key to abort"
+ c = getc
+ # we test for \r and \n because some stuff does \r instead
+ abort unless c == 13 or c == 10
+end
+
def macos_version
@macos_version ||= /(10\.\d+)(\.\d+)?/.match(`/usr/bin/sw_vers -productVersion`).captures.first.to_f
end
@@ -120,13 +128,7 @@ unless chgrps.empty?
puts *chgrps
end
-if STDIN.tty?
- puts
- puts "Press enter to continue"
- c = getc
- # we test for \r and \n because some stuff does \r instead
- abort unless c == 13 or c == 10
-end
+wait_for_user if STDIN.tty?
if File.directory? HOMEBREW_PREFIX
sudo "/bin/chmod", "g+rwx", *chmods unless chmods.empty?