From 329e357d9acdd7989cb3ba6394f3b4839bb1e83f Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Thu, 3 Jul 2014 20:50:04 +0800 Subject: [PATCH] plist_caveats: simplify the block and add a comment Closes Homebrew/homebrew#30630. Signed-off-by: Mike McQuaid --- Library/Homebrew/caveats.rb | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/Library/Homebrew/caveats.rb b/Library/Homebrew/caveats.rb index 1973dff421..fa37c62891 100644 --- a/Library/Homebrew/caveats.rb +++ b/Library/Homebrew/caveats.rb @@ -104,22 +104,20 @@ class Caveats else s << " launchctl load #{plist_link}" end - else - if f.plist_startup + # For startup plists, we cannot tell whether it's running on launchd, + # as it requires for `sudo launchctl list` to get real result. + elsif 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 - 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 + elsif 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 if f.plist_manual