module Web.Browser.OS
( openBrowser
) where
import Control.Monad ( void )
import System.Process
( CreateProcess (..), StdStream (..), createProcess, proc )
openBrowser ::
String
-> IO ()
openBrowser :: String -> IO ()
openBrowser String
url = IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
-> IO ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
-> IO ())
-> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
-> IO ()
forall a b. (a -> b) -> a -> b
$ CreateProcess
-> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
createProcess (String -> [String] -> CreateProcess
proc String
"xdg-open" [String
url])
{ std_in = NoStream
, std_out = NoStream
, std_err = NoStream
, close_fds = True
}