mitranim / mitranim/gow

Support redirected input (and send all of it on every invocation)

Open
#41 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
906
Forks
29
PR merge metrics
No merged PRs in 30d

Description

It's tempting to do something like gow run main.go < input.txt, but this will effectively run the application with that input once, and then basically freeze because the application is waiting for input but no more is coming.

gow (or some underlying library it uses) seemingly already detects that input is not a TTY, since it logs [gow] unable to read terminal state: inappropriate ioctl for device; it would be nice if it could in this case instead consume all of STDIN and store it, and then send it to the program on every invocation. If it can't detect it automatically, it could also be controlled with a flag, e.g. gow -T (for no-TTY; a lot of the good letters are already taken...).

If there's some other usage pattern that will allow me to do effectively the same thing, that'd be nice to document too! Currently I'm stuck with one terminal running gow -c build -o bin/my-app main.go and another ls bin/ | entr -rc sh -c 'bin/my-app < input.txt' which is just annoying... :)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the gow command's handling of redirected STDIN and its existing TTY-state detection. The change is done when redirected input is consumed and sent to the application on every invocation, or when an equivalent supported usage is documented; verify behavior with the input.txt and gow commands described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.