Skip to content

Document on_output option in Bash.run/3 - #9

Merged
dbernheisel merged 1 commit into
tv-labs:mainfrom
lostbean:egomes/document-on-output-in-run
Apr 12, 2026
Merged

Document on_output option in Bash.run/3#9
dbernheisel merged 1 commit into
tv-labs:mainfrom
lostbean:egomes/document-on-output-in-run

Conversation

@lostbean

Copy link
Copy Markdown
Contributor

Motivation

Bash.run/3 passes opts through to Session.execute/3, which supports :on_output for streaming output as it's produced. The streaming works, but Bash.run/3's docstring doesn't mention it. The only documentation for :on_output is on Session.execute/3 directly. Users of the convenience API have no way to know streaming is available without diving into internals, which leads to bypassing Bash.run/3 entirely and calling Bash.parse/1 + Bash.Session.execute/3 directly.

Requirements

  1. Add :on_output to Bash.run/3's @doc as a supported option, with the same description as Session.execute/3.
  2. Add a usage example showing streaming.
  3. If on_output is intentionally unsupported through run/3, document that and raise if passed.

Validations

chunks = []
Bash.run("echo hello", nil, on_output: fn event -> send(self(), event) end)
assert_receive {:stdout, "hello\n"}

Purely a documentation change — the code already works.

  • Added test confirming on_output works through Bash.run/3
  • Full test suite passes (no regressions)

The on_output streaming callback was supported through opts passthrough
to Session.execute/3 but not documented in the Bash.run/3 docstring.
Add it to the options list with a usage example.
@dbernheisel
dbernheisel merged commit 4b6591d into tv-labs:main Apr 12, 2026
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.

2 participants