packages feed

posix-pty 0.2.1 → 0.2.1.1

raw patch · 3 files changed

+29/−12 lines, 3 filesdep +posix-ptydep ~basedep ~bytestringdep ~process

Dependencies added: posix-pty

Dependency ranges changed: base, bytestring, process

Files

cbits/fork_exec_with_pty.c view
@@ -41,23 +41,14 @@     int pty;     int packet_mode = 1;     struct winsize ws;-    struct termios tio;      /* Set the terminal size and settings. */     memset(&ws, 0, sizeof ws);     ws.ws_col = sx;     ws.ws_row = sy; -    memset(&tio, 0, sizeof tio);-    tio.c_iflag = TTYDEF_IFLAG;-    tio.c_oflag = TTYDEF_OFLAG;-    tio.c_lflag = TTYDEF_LFLAG;-    tio.c_cflag = TTYDEF_CFLAG;-    memcpy(&tio.c_cc, ttydefchars, sizeof tio.c_cc);-    cfsetspeed(&tio, TTYDEF_SPEED);-     /* Fork and exec, returning the master pty. */-    *child_pid = forkpty(&pty, NULL, &tio, &ws);+    *child_pid = forkpty(&pty, NULL, NULL, &ws);     switch (*child_pid) {     case -1:         return -1;
posix-pty.cabal view
@@ -1,5 +1,5 @@ Name:                posix-pty-Version:             0.2.1+Version:             0.2.1.1  Homepage:            https://bitbucket.org/merijnv/posix-pty Bug-Reports:         https://github.com/merijn/posix-pty/issues@@ -28,7 +28,7 @@ Library   Default-Language:     Haskell2010   GHC-Options:          -Wall-  GHC-Prof-Options:     -auto-all -caf-all -rtsopts+  GHC-Prof-Options:     -auto-all -caf-all   Exposed-Modules:      System.Posix.Pty   Other-Modules:         @@ -44,6 +44,17 @@    if os(linux) || os(freebsd)     Extra-Libraries: util++Test-Suite stty+  Type: exitcode-stdio-1.0+  Default-Language:     Haskell2010+  Main-Is:              stty.hs+  Ghc-Options:          -w -threaded -rtsopts -with-rtsopts=-N+  Hs-Source-Dirs:       tests+  Build-Depends:        base+               ,        bytestring+               ,        posix-pty+               ,        process  Source-Repository head   Type:     git
+ tests/stty.hs view
@@ -0,0 +1,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