Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to write to STDIN #79

Merged
merged 9 commits into from
Nov 30, 2024
Merged

Add ability to write to STDIN #79

merged 9 commits into from
Nov 30, 2024

Conversation

schneems
Copy link
Member

@schneems schneems commented Nov 27, 2024

  • Add: Rundoc command background.stdin_write to send a string to a backtround process' STDIN. This allows driving REPL interfaces:
:::>- background.start("ruby #{script}",
  name: "script",
  wait: ">",
  timeout: 15
)
:::-- background.stdin_write("hello", name: "script", wait: "hello")
:::-- background.stdin_write("exit", name: "script", wait: "exit")
:::>> background.stop(name: "script")

@schneems schneems force-pushed the schneems/background-stdin branch 2 times, most recently from 3ff90ea to 1435069 Compare November 29, 2024 21:54
Needs:

- Integration test
- README docs

Notably, the hard part about this might not be writing the values to stdin, but rather dealing with the fact that most interactive processes behave VERY differently when run without a TTY. There are workarounds such as using the `script` command line tool, however integrating with a TTY shall be an exercise for the reader.
String#match? Converts strings into regexes which is unexpected and not what we want.
@schneems schneems force-pushed the schneems/background-stdin branch from 0a13458 to 3d85666 Compare November 29, 2024 21:57
@schneems schneems marked this pull request as ready for review November 29, 2024 21:58
@schneems schneems force-pushed the schneems/background-stdin branch from 3d85666 to ec74360 Compare November 29, 2024 22:00
@schneems schneems force-pushed the schneems/background-stdin branch from ec74360 to 304ee99 Compare November 30, 2024 03:26
@schneems schneems merged commit 5b13cc8 into main Nov 30, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant