fix: replace Go PTY tests with txtar using creack/pty#2682
Merged
michaeldwan merged 2 commits intomainfrom Feb 4, 2026
Merged
Conversation
The TestInteractiveTTY test was flaky on macOS because testscript's native ttyin/ttyout uses Go's setctty syscall which hangs due to Go bug golang/go#61779. This replaces the Go-based PTY tests with txtar tests using the new pty-run command, which uses github.com/creack/pty that works correctly on both Linux and macOS. Changes: - Add pty-run testscript command using creack/pty - Add Command interface for cleaner command organization - Convert PTY tests to txtar format (pty_echo, pty_interactive) - Remove old Go-based pty/pty_test.go - Update README with pty-run documentation
markphelps
approved these changes
Feb 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
creack/ptypty-runtestscript command for PTY interaction in txtar testsProblem
The
TestInteractiveTTYtest was flaky on macOS because testscript's nativettyin/ttyoutuses Go'ssetcttysyscall which hangs due to Go bug #61779. This bug affects macOS and causescmd.Wait()to hang indefinitely when usingSysProcAttr.Setctty.Solution
Replace the Go-based PTY tests with txtar tests using a new
pty-runcommand that usesgithub.com/creack/pty, which works correctly on both Linux and macOS.Changes
pty-runcommand (integration-tests/harness/cmd_pty.go): Executes commands with a PTY, sending input from a file and capturing outputintegration-tests/harness/command.go): Cleaner organization for testscript commandspty_echo.txtarandpty_interactive.txtarintegration-tests/pty/pty_test.go(replaced by txtar tests)pty-runcommandTesting
Both tests pass locally on macOS:
Future
Added a TODO to remove this implementation once Go bug #61779 is fixed (check Go 1.26+).