make this build under windows
This commit is contained in:
parent
b2834db613
commit
d785a565ef
1 changed files with 9 additions and 0 deletions
|
@ -5,12 +5,16 @@
|
||||||
- License: BSD-2-clause
|
- License: BSD-2-clause
|
||||||
-}
|
-}
|
||||||
|
|
||||||
|
{-# LANGUAGE CPP #-}
|
||||||
|
|
||||||
module Utility.Su where
|
module Utility.Su where
|
||||||
|
|
||||||
import Common
|
import Common
|
||||||
import Utility.Env
|
import Utility.Env
|
||||||
|
|
||||||
|
#ifndef mingw32_HOST_OS
|
||||||
import System.Posix.Terminal
|
import System.Posix.Terminal
|
||||||
|
#endif
|
||||||
|
|
||||||
data WhosePassword
|
data WhosePassword
|
||||||
= RootPassword
|
= RootPassword
|
||||||
|
@ -55,6 +59,7 @@ runSuCommand Nothing = return False
|
||||||
-- that and the command failing. Although, some commands like gksu
|
-- that and the command failing. Although, some commands like gksu
|
||||||
-- decide based on the system's configuration whether sudo should be used.
|
-- decide based on the system's configuration whether sudo should be used.
|
||||||
mkSuCommand :: String -> [CommandParam] -> IO (Maybe SuCommand)
|
mkSuCommand :: String -> [CommandParam] -> IO (Maybe SuCommand)
|
||||||
|
#ifndef mingw32_HOST_OS
|
||||||
mkSuCommand cmd ps = firstM (\(SuCommand _ p _) -> inPath p) =<< selectcmds
|
mkSuCommand cmd ps = firstM (\(SuCommand _ p _) -> inPath p) =<< selectcmds
|
||||||
where
|
where
|
||||||
selectcmds = ifM (inx <||> (not <$> atconsole))
|
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)
|
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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue