Idris2/tests/base/system_run/Run.idr
2021-11-05 11:59:17 +00:00

20 lines
504 B
Idris

import Data.String
import System
import System.Info
main : IO ()
main = do
(contents, 0) <- run $ "echo " ++ escapeArg "Hello, world"
| (_, err) => printLn err
printLn $ trim contents
let cmd : List String = if not isWindows
then ["printf", "Hello, %s", "$PATH"]
else ["echo", "Hello, $PATH"]
(contents, 0) <- run cmd
| (_, err) => printLn err
printLn $ trim contents
printLn !(run ["exit", "17"])