Permalink
Browse files

Notify user of how to abort installation

Notify users that hitting any key other than ENTER will abort the installer.
  • Loading branch information...
1 parent 5608ad6 commit 0019042efdc2cbfedd2e7bd5f311166ac70c5b88 @Sharpie committed Sep 24, 2012
Showing with 9 additions and 7 deletions.
  1. +9 −7 install
View
16 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?

0 comments on commit 0019042

Please sign in to comment.