From 559931697141380e33138d35cf39cd60b9a8c741 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Fri, 23 Oct 2009 14:49:48 +0100 Subject: [PATCH] Don't look broken if CWD doesn't exist Ruby throws if CWD doesn't exist, even when you aren't doing anything related to the CWD. Sucks. So at least show the user a friendly error message rather than looking broken. --- bin/brew | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/brew b/bin/brew index ddece3cf02..3e756ccb97 100755 --- a/bin/brew +++ b/bin/brew @@ -1,6 +1,10 @@ #!/usr/bin/ruby # -*- coding: utf-8 -*- +# Many Pathname operations use getwd when they shouldn't, and then throw +# odd exceptions. Reduce our support burden by showing a user-friendly error. +Dir.getwd rescue abort "The current working directory doesn't exist, cannot proceed." + def homebrew_rubylib_path lib_path = "/../../Library/Homebrew" # we resolve off of Dir.getwd as otherwise the symlink gets resolved!