Lib.hs 749 B

1234567891011121314151617181920212223242526
  1. module Lib
  2. ( testProcess
  3. ) where
  4. import System.Process
  5. import GHC.IO.Handle
  6. import Control.Concurrent
  7. testProcess :: IO ()
  8. testProcess = do
  9. -- (Just hin, , _, p) <- createProcess (proc "mpv" ["--input-terminal=yes", "/home/josh/'IS THAT A MAN RIDING A SHRIMP'-9p_QW_HsKPI.mp3"]){ std_in = CreatePipe, std_out = NoStream, std_err = NoStream}
  10. (Just hin, Just hout, _, c) <- createProcess (proc "cat" []){ std_in = CreatePipe , std_out = CreatePipe}
  11. hSetBuffering hin NoBuffering
  12. threadDelay 2000000
  13. hPutChar hin 'p'
  14. hPutChar hin '\n'
  15. threadDelay 2000000
  16. hPutChar hin 'p'
  17. hPutChar hin '\n'
  18. threadDelay 2000000
  19. hPutChar hin 'p'
  20. hPutChar hin '\n'
  21. hClose hin
  22. waitForProcess c
  23. b <- hGetLine hout
  24. putStrLn (show b)