this way of starting a browser seems more robust (#6)
This commit is contained in:
parent
44de5419a5
commit
d64d0b92d7
4
Utils.hs
4
Utils.hs
@ -19,7 +19,7 @@ import System.IO.UTF8 (hPutStrLn)
|
|||||||
import System.IO (hPutStrLn)
|
import System.IO (hPutStrLn)
|
||||||
#endif
|
#endif
|
||||||
import System.Exit
|
import System.Exit
|
||||||
import System.Cmd (system)
|
import System.Process (readProcessWithExitCode)
|
||||||
import System.Info (os)
|
import System.Info (os)
|
||||||
import System.Time (ClockTime,getClockTime)
|
import System.Time (ClockTime,getClockTime)
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ openBrowserOn :: String -> IO ExitCode
|
|||||||
openBrowserOn u = trybrowsers browsers u
|
openBrowserOn u = trybrowsers browsers u
|
||||||
where
|
where
|
||||||
trybrowsers (b:bs) u = do
|
trybrowsers (b:bs) u = do
|
||||||
e <- system $ printf "%s %s" b u
|
(e,_,_) <- readProcessWithExitCode b [u] ""
|
||||||
case e of
|
case e of
|
||||||
ExitSuccess -> return ExitSuccess
|
ExitSuccess -> return ExitSuccess
|
||||||
ExitFailure _ -> trybrowsers bs u
|
ExitFailure _ -> trybrowsers bs u
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user