-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more process functions and a motivating example (#73)
* make `Process.runProcess` and `Process.runProcess_` polymorphic over streams * add `Process.setStdout` and `Process.useHandleClose` primitives * create example of using a handle for the stdout of a process
- Loading branch information
1 parent
c60d0df
commit 78c8647
Showing
2 changed files
with
14 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters