aboutsummaryrefslogtreecommitdiff
path: root/Utility
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-12-30 11:04:00 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-12-30 11:04:00 -0400
commit156896b1780f87581c99b77349a16a76fb2b672c (patch)
treed89d8102e6801bc7a1d67488c9a7e99d3810432d /Utility
parent180a849817531cc710c785451975c3883bbaf181 (diff)
make this build under windows
Diffstat (limited to 'Utility')
-rw-r--r--Utility/Su.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/Utility/Su.hs b/Utility/Su.hs
index b8df07dd3..ace8cbf3e 100644
--- a/Utility/Su.hs
+++ b/Utility/Su.hs
@@ -5,12 +5,16 @@
- License: BSD-2-clause
-}
+{-# LANGUAGE CPP #-}
+
module Utility.Su where
import Common
import Utility.Env
+#ifndef mingw32_HOST_OS
import System.Posix.Terminal
+#endif
data WhosePassword
= RootPassword
@@ -55,6 +59,7 @@ runSuCommand Nothing = return False
-- that and the command failing. Although, some commands like gksu
-- decide based on the system's configuration whether sudo should be used.
mkSuCommand :: String -> [CommandParam] -> IO (Maybe SuCommand)
+#ifndef mingw32_HOST_OS
mkSuCommand cmd ps = firstM (\(SuCommand _ p _) -> inPath p) =<< selectcmds
where
selectcmds = ifM (inx <||> (not <$> atconsole))
@@ -91,3 +96,7 @@ mkSuCommand cmd ps = firstM (\(SuCommand _ p _) -> inPath p) =<< selectcmds
]
shellcmd = unwords $ map shellEscape (cmd:toCommand ps)
+#else
+-- For windows, we assume the user has administrator access.
+mkSuCommand cmd ps = SuCommand NoPromptPassword cmd ps
+#endif