From ddf22735db7241f6388bd7048e4702e78eab66b2 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Thu, 3 Jul 2014 19:28:09 +0800 Subject: [PATCH] plist_caveats: remove `launchctl list` as it requires sudo for root services --- Library/Homebrew/caveats.rb | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/Library/Homebrew/caveats.rb b/Library/Homebrew/caveats.rb index cd03952ee2..1973dff421 100644 --- a/Library/Homebrew/caveats.rb +++ b/Library/Homebrew/caveats.rb @@ -104,33 +104,30 @@ class Caveats else s << " launchctl load #{plist_link}" end - if f.plist_manual - s << "Or, if you don't want/need launchctl, you can just run:" - s << " #{f.plist_manual}" - end - elsif Kernel.system "/bin/launchctl list #{plist_domain} &>/dev/null" - s << "To reload #{f.name} after an upgrade:" + else if f.plist_startup + s << "To reload #{f.name} after an upgrade:" s << " sudo launchctl unload #{plist_link}" s << " sudo cp -fv #{f.opt_prefix}/*.plist #{destination}" s << " sudo launchctl load #{plist_link}" else - s << " launchctl unload #{plist_link}" - s << " launchctl load #{plist_link}" - end - else - s << "To load #{f.name}:" - if f.plist_startup - s << " sudo launchctl load #{plist_link}" - else - s << " launchctl load #{plist_link}" - end - if f.plist_manual - s << "Or, if you don't want/need launchctl, you can just run:" - s << " #{f.plist_manual}" + if Kernel.system "/bin/launchctl list #{plist_domain} &>/dev/null" + s << "To reload #{f.name} after an upgrade:" + s << " launchctl unload #{plist_link}" + s << " launchctl load #{plist_link}" + else + s << "To load #{f.name}:" + s << " launchctl load #{plist_link}" + end end end - s << '' << "WARNING: launchctl will fail when run under tmux." if ENV['TMUX'] + + if f.plist_manual + s << "Or, if you don't want/need launchctl, you can just run:" + s << " #{f.plist_manual}" + end + + s << "" << "WARNING: launchctl will fail when run under tmux." if ENV['TMUX'] end s.join("\n") unless s.empty? end