recognise differently-named shaN programs
This commit is contained in:
parent
bd1bbc21fa
commit
f5b2d650bb
3 changed files with 28 additions and 13 deletions
|
@ -72,13 +72,25 @@ selectCmd k cmds = search cmds
|
|||
where
|
||||
search [] = do
|
||||
testEnd $ Config k (BoolConfig False)
|
||||
error $ "* need one of these commands, but none are available: " ++ show cmds
|
||||
error $ "* need one of these commands, but none are available: " ++ show (map (head . words) cmds)
|
||||
search (c:cs) = do
|
||||
ret <- system $ quiet c
|
||||
if (ret == ExitSuccess)
|
||||
then return $ Config k (StringConfig c)
|
||||
else search cs
|
||||
|
||||
whichCmd :: ConfigKey -> [String] -> Test
|
||||
whichCmd k cmds = search cmds
|
||||
where
|
||||
search [] = do
|
||||
testEnd $ Config k (StringConfig "")
|
||||
return $ Config k (StringConfig "")
|
||||
search (c:cs) = do
|
||||
ret <- system $ quiet c
|
||||
if (ret == ExitSuccess)
|
||||
then return $ Config k (StringConfig $ head $ words c)
|
||||
else search cs
|
||||
|
||||
quiet :: String -> String
|
||||
quiet s = s ++ " >/dev/null 2>&1"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue