| 1 |
-------------------------------------------------------------------------------- |
| 2 |
-- For Unix-like operating systems that provide the xdg-open script on the PATH. |
| 3 |
-------------------------------------------------------------------------------- |
| 4 |
|
| 5 |
module Web.Browser.OS |
| 6 |
( openBrowserWithExitCode |
| 7 |
) where |
| 8 |
|
| 9 |
import System.Exit ( ExitCode (..) ) |
| 10 |
import System.Process ( readProcessWithExitCode ) |
| 11 |
|
| 12 |
-- https://ss64.com/bash/xdg-open.html |
| 13 |
openBrowserWithExitCode :: |
| 14 |
String |
| 15 |
-- ^ URL or other item to try to open. |
| 16 |
-> IO (ExitCode, String, String) |
| 17 |
openBrowserWithExitCode url = readProcessWithExitCode "xdg-open" [url] "" |