From 357cbaff0221bc2371ebe357dbe2c57a373c11e1 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 28 Dec 2016 15:55:54 -0400 Subject: improve description of password prompting Since the user does not know whether it will run su or sudo, indicate whether the password prompt will be for root or the user's password, when possible. I assume that programs like gksu that can prompt for either depending on system setup will make clear in their prompt what they're asking for. --- Command/EnableTor.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Command') diff --git a/Command/EnableTor.hs b/Command/EnableTor.hs index 6f145413d..27e57d649 100644 --- a/Command/EnableTor.hs +++ b/Command/EnableTor.hs @@ -49,10 +49,12 @@ start os = do Just userid -> go uuid userid else do showStart "enable-tor" "" - showLongNote "Need root access to enable tor..." gitannex <- liftIO readProgramFile let ps = [Param (cmdname cmd), Param (show curruserid)] - ifM (liftIO $ runAsRoot gitannex ps) + sucommand <- liftIO $ mkSuCommand gitannex ps + maybe noop showLongNote + (describePasswordPrompt' sucommand) + ifM (liftIO $ runSuCommand sucommand) ( next $ next checkHiddenService , giveup $ unwords $ [ "Failed to run as root:" , gitannex ] ++ toCommand ps -- cgit v1.2.3