diff options
author | Fraser Tweedale <frase@frase.id.au> | 2011-04-08 10:08:11 +1000 |
---|---|---|
committer | Fraser Tweedale <frase@frase.id.au> | 2011-04-08 10:08:11 +1000 |
commit | f5b2d650bb75dc7ca2f77dae59fb1ab7f7405e03 (patch) | |
tree | b8dbb3f450e2ec18cdfe1128e9c21adfb6e2b953 /TestConfig.hs | |
parent | bd1bbc21fac4b36975d03638d15e9aab915927cf (diff) |
recognise differently-named shaN programs
Diffstat (limited to 'TestConfig.hs')
-rw-r--r-- | TestConfig.hs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/TestConfig.hs b/TestConfig.hs index 5e59681dd..d1560b660 100644 --- a/TestConfig.hs +++ b/TestConfig.hs @@ -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" |