Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process Stdin example #181

Open
locallycompact opened this issue May 26, 2019 · 1 comment
Open

Process Stdin example #181

locallycompact opened this issue May 26, 2019 · 1 comment

Comments

@locallycompact
Copy link
Collaborator

Hi, I'm struggling to figure out how to do the equivalent of this in typed-process. Is there an example of how to use stdin with the different RIO.Process proc?

import RIO.Process
import qualified System.Process.Typed as S
let catConfig = setStdin (byteStringInput "foo")
                      $ S.proc "less" []
runProcess catConfig
@snoyberg
Copy link
Collaborator

Is this what you're looking for?

#!/usr/bin/env stack
-- stack --resolver lts-13.21 script
{-# LANGUAGE NoImplicitPrelude, OverloadedStrings #-}
import RIO
import RIO.Process
import qualified System.Process.Typed as S

main :: IO ()
main =
  runSimpleApp $
  proc "less" [] $
  runProcess_ . setStdin (byteStringInput "foo")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants