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