diff --git a/examples/30-process-handlers.hell b/examples/30-process-handlers.hell new file mode 100644 index 0000000..5959ad7 --- /dev/null +++ b/examples/30-process-handlers.hell @@ -0,0 +1,8 @@ +main = do + Temp.withSystemTempFile "example" \filePath handle -> do + Text.putStrLn $ Text.concat ["Created temp file ", filePath] + let proc = Process.setStdout (Process.useHandleClose handle) $ + Process.proc "ls" ["-al"] + Process.runProcess_ proc + contents <- Text.readFile filePath + Text.putStrLn contents diff --git a/src/Hell.hs b/src/Hell.hs index 23f7063..1913255 100644 --- a/src/Hell.hs +++ b/src/Hell.hs @@ -1250,8 +1250,7 @@ supportedLits = -- Process ("Process.proc", lit' $ \n xs -> proc (Text.unpack n) (map Text.unpack xs)), ("Process.setEnv", lit' $ Process.setEnv @() @() @() . map (bimap Text.unpack Text.unpack)), - ("Process.runProcess", lit' $ runProcess @IO @() @() @()), - ("Process.runProcess_", lit' $ runProcess_ @IO @() @() @()), + -- Exit ("Exit.ExitSuccess", lit' Exit.ExitSuccess), ("Exit.ExitFailure", lit' Exit.ExitFailure), @@ -1594,6 +1593,11 @@ polyLits = -- Temp "Temp.withSystemTempFile" temp_withSystemTempFile :: forall a. Text -> (Text -> IO.Handle -> IO a) -> IO a "Temp.withSystemTempDirectory" temp_withSystemTempDirectory :: forall a. Text -> (Text -> IO a) -> IO a + -- Process + "Process.runProcess" runProcess :: forall a b c. ProcessConfig a b c -> IO ExitCode + "Process.runProcess_" runProcess_ :: forall a b c. ProcessConfig a b c -> IO () + "Process.setStdout" setStdout :: forall stdin stdout stdout' stderr. StreamSpec 'STOutput stdout' -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout' stderr + "Process.useHandleClose" useHandleClose :: forall (a :: StreamType). IO.Handle -> StreamSpec a () |] )