aboutsummaryrefslogtreecommitdiff
path: root/Utility/INotify.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-10-06 16:16:31 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-10-06 16:16:31 -0400
commitdbf59167c40b112c78b4beeee3025eb2438a8f8e (patch)
tree9f39c8805944ef94a7b1045b9caae5be9617cd1d /Utility/INotify.hs
parentc2017cd2f5d7a80d13c6f242f84a3eb7a6c9b576 (diff)
look for sysctl in some common sbin locations when it's not in PATH
Diffstat (limited to 'Utility/INotify.hs')
-rw-r--r--Utility/INotify.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/Utility/INotify.hs b/Utility/INotify.hs
index 7934c2446..b55fbc953 100644
--- a/Utility/INotify.hs
+++ b/Utility/INotify.hs
@@ -164,10 +164,11 @@ tooManyWatches hook dir = do
]
querySysctl :: Read a => [CommandParam] -> IO (Maybe a)
-querySysctl ps = do
- v <- catchMaybeIO $ readProcess "sysctl" (toCommand ps)
- case v of
- Nothing -> return Nothing
- Just s -> return $ parsesysctl s
+querySysctl ps = getM go ["sysctl", "/sbin/sysctl", "/usr/sbin/sysctl"]
where
+ go p = do
+ v <- catchMaybeIO $ readProcess p (toCommand ps)
+ case v of
+ Nothing -> return Nothing
+ Just s -> return $ parsesysctl s
parsesysctl s = readish =<< lastMaybe (words s)