Gabriella439 / Gabriella439/turtle
Turtle.Prelude.proc and Turtle.Prelude.shell don't pass keyboard input to ncurses programs.
- Dominant language
- Haskell
- Stars
- 978
- Forks
- 94
- PR merge metrics
- No merged PRs in 30d
Description
I needed to press space bar on an ncurses program, but `proc` and `shell` couldn't do it.
I had to replace them with `import System.Process (spawnProcess, waitForProcess)`.
Below is how I use `spawnProcess` and `waitForProcess`.
```haskell
{-# LANGUAGE OverloadedStrings #-}
module TermdownAlarm where
import System.Process (spawnProcess, waitForProcess)
import Control.Monad (void)
import Data.Text (Text, unpack)
import Turtle (proc, empty)
import System.Exit (ExitCode(..))
termdownAlarm :: Text -> Text -> Text -> IO ()
termdownAlarm title duration file = do
exitCode <- spawnProcess "termdown"
[ "--alt-format", "--no-figlet"
, "--critical", "10", "--no-window-title", "--title"
, unpack title, unpack duration ] >>= waitForProcess
case exitCode of
ExitFailure _ -> return ()
ExitSuccess ->
void $ proc "mpv" ["--really-quiet", "--volume=100", file] empty
```
I can press space bar to pause and resume timer in `termdown` which is an ncurses program.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at Turtle.Prelude.proc and Turtle.Prelude.shell, then compare their behavior with System.Process.spawnProcess and waitForProcess shown in the report. Done means child ncurses programs receive keyboard input, including the space bar, when launched through proc or shell.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100