From d1eb1ae377a0374b68d791aaa549fc79e3d4221a Mon Sep 17 00:00:00 2001 From: Austin Platt Date: Tue, 7 Jan 2025 14:26:46 +0000 Subject: [PATCH] create example of using a handle for the stdout of a process --- examples/30-process-handlers.hell | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 examples/30-process-handlers.hell diff --git a/examples/30-process-handlers.hell b/examples/30-process-handlers.hell new file mode 100644 index 0000000..429e49e --- /dev/null +++ b/examples/30-process-handlers.hell @@ -0,0 +1,10 @@ +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 + +