Skip to content

Conversation

@jasonwbarnett
Copy link
Contributor

Closes #1179

Context

Currently, using interactive: true in non-TTY environments (like VS Code's commit interface, GitHub Desktop, or CI/CD pipelines) fails with the error:

Couldn't enable TTY input: open /dev/tty: device not configured

This happens because interactive: true attempts to open /dev/tty for user input, which doesn't exist in these environments. Users who want real-time streaming output but don't need user input have no good alternative.

Changes

This PR adds a new stream configuration option that enables real-time log streaming without requiring a TTY:

  • Added stream field to Command, Script, and Job config structs
  • Updated executor logic in exec_unix.go and exec_windows.go to handle stream mode
    • Stream mode pipes stdout/stderr directly without attempting to open /dev/tty
    • Only interactive: true attempts TTY access; stream: true works in all environments
  • Updated JSON schemas with the new stream property
  • Added comprehensive documentation at docs/mdbook/configuration/stream.md

Key differences:

  • stream: true - Real-time output, no TTY required, no user input
  • interactive: true - Requires TTY for user input
  • use_stdin: true - Passes stdin but doesn't control output streaming
  • Default (all false) - Uses pseudo-TTY for output buffering

Example usage:

pre-commit:
  commands:
    tests:
      run: npm test
      stream: true
    lint:
      run: npm run lint
      stream: true

This allows developers to see test and lint output in real-time when committing from VS Code or other non-TTY environments, without encountering TTY errors.

Add a new stream configuration option that enables real-time log
streaming without requiring a TTY. This solves the issue where using
interactive: true in non-TTY environments (like VS Code's commit
interface) would fail with "Couldn't enable TTY input: open /dev/tty:
device not configured".

Key differences:
- stream: true - Real-time output, no TTY required, no user input
- interactive: true - Requires TTY for user input

Changes:
- Add Stream field to Command, Script, and Job config structs
- Update exec.Options to include Stream parameter
- Modify exec_unix.go and exec_windows.go to handle Stream mode
- Update JSON schemas with new stream property
- Add comprehensive documentation for the stream feature

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@jasonwbarnett jasonwbarnett requested a review from mrexox as a code owner October 31, 2025 19:32
@mrexox
Copy link
Member

mrexox commented Nov 1, 2025

Hey! Thank you for preparing the PR. Have you seen the follow option? It must connect directly to the STDOUT and print output as it occurs. It does pretty the same as stream

@jasonwbarnett
Copy link
Contributor Author

No, I had not seen follow 🫠

I'll try it out today and let you know if I have issues. Thanks!

@jasonwbarnett
Copy link
Contributor Author

It would be nice to control this on a per job basis though instead of the entire hook.

@mrexox
Copy link
Member

mrexox commented Nov 5, 2025

Agree, but maybe it will require to change the order of jobs and delay printing the output of those without follow: true. But that's a valid feature request. Do you want to reopen the issue?

@jasonwbarnett jasonwbarnett reopened this Nov 6, 2025
@jasonwbarnett
Copy link
Contributor Author

Re-opened! 😄

Let me know if you think we need to make any changes to the source or docs, etc. Happy to work with you to get this in. Also, let me know if you think.

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.

feat: Add stream option for real-time output without requiring TTY

2 participants