diff options
-rw-r--r-- | Pty.hs | 9 | ||||
-rw-r--r-- | TODO | 1 |
2 files changed, 5 insertions, 5 deletions
@@ -1,7 +1,7 @@ module Pty (Pty, runWithPty, readPty, writePty) where import System.Posix -import System.Posix.Pty hiding (setTerminalAttributes, getTerminalAttributes) +import System.Posix.Pty import qualified System.Console.Terminal.Size as Console import System.Posix.Signals.Exts import System.Process @@ -17,11 +17,12 @@ runWithPty :: String -> [String] -> ((Pty, ProcessHandle) -> IO a) -> IO a runWithPty cmd params a = bracket setup cleanup go where setup = do - as <- getTerminalAttributes stdInput + as <- System.Posix.getTerminalAttributes stdInput sz <- Console.size (p, ph) <- spawnWithPty Nothing True cmd params (maybe 80 Console.width sz, maybe 25 Console.height sz) _ <- installHandler windowChange (Catch (forwardresize p)) Nothing + System.Posix.Pty.setTerminalAttributes p as Immediately -- This is similar to cfmakeraw(3). let masteras = as `withoutMode` IgnoreBreak @@ -39,7 +40,7 @@ runWithPty cmd params a = bracket setup cleanup go `withoutMode` KeyboardInterrupts `withoutMode` ExtendedFunctions `withoutMode` EnableParity - setTerminalAttributes stdInput masteras Immediately + System.Posix.setTerminalAttributes stdInput masteras Immediately return (p, ph, as) cleanup (p, ph, as) = do -- Needed in case the provided action throws an exception @@ -47,7 +48,7 @@ runWithPty cmd params a = bracket setup cleanup go terminateProcess ph closePty p _ <- installHandler windowChange Default Nothing - setTerminalAttributes stdInput as Immediately + System.Posix.setTerminalAttributes stdInput as Immediately go (p, ph, _) = a (p, ph) forwardresize p = do msz <- Console.size @@ -1,4 +1,3 @@ -* control-d does not exit debug-me * Uncommenting the networkDelay in sendPtyOutput exposes a bug in the Activity chain construction. * potential DOS where developer sends Activity Entered that all |