2024-11-03 12:41:51 +03:00
|
|
|
-- SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
|
|
|
module Main where
|
|
|
|
|
|
|
|
import Control.Monad.Hefty (liftIO, (&))
|
|
|
|
import Control.Monad.Hefty.Concurrent.Subprocess (
|
|
|
|
CreateProcess (stdout),
|
|
|
|
StdStream (CreatePipe),
|
|
|
|
SubprocResult,
|
|
|
|
readStdout'',
|
|
|
|
runSubprocIO,
|
|
|
|
scope,
|
|
|
|
shell,
|
|
|
|
)
|
|
|
|
import Control.Monad.Hefty.Unlift (runUnliftIO)
|
|
|
|
|
|
|
|
main :: IO ()
|
|
|
|
main = runUnliftIO . runSubprocIO $ do
|
2024-11-03 12:52:57 +03:00
|
|
|
r <- scope @"echo" @SubprocResult (shell "echo a b c") {stdout = CreatePipe} \_ -> do
|
|
|
|
readStdout'' @"echo"
|
2024-11-03 12:41:51 +03:00
|
|
|
print r & liftIO
|
2024-11-03 12:48:59 +03:00
|
|
|
|
|
|
|
{-
|
|
|
|
SubprocScopeResult ExitSuccess "a b c\n"
|
|
|
|
-}
|