File: stty.hs

package info (click to toggle)
haskell-posix-pty 0.2.2-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 88 kB
  • sloc: haskell: 244; ansic: 109; makefile: 6
file content (15 lines) | stat: -rw-r--r-- 418 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{-# LANGUAGE LambdaCase #-}
module Main where

import Control.Monad (forever, void)
import Data.ByteString as BS (putStr)
import System.Process (waitForProcess)
import System.Posix.Pty

main :: IO ()
main = do
    (pty, hnd) <- spawnWithPty Nothing True "stty" ["-a"] (10, 10)
    forever $ tryReadPty pty >>= \case
        Left e -> print e
        Right s -> BS.putStr s >> putStrLn ""
    void $ waitForProcess hnd