Skip to content

test(lorectl): open the test terminal close-on-exec - #415

Merged
hsusul merged 1 commit into
mainfrom
fix/test-pty-cloexec
Nov 9, 2026
Merged

hsusul merged 1 commit into
mainfrom
fix/test-pty-cloexec

Conversation

@hsusul

@hsusul hsusul commented Nov 9, 2026

Copy link
Copy Markdown
Owner

What

on_a_terminal (crates/lorectl/tests/common/mod.rs, added with #397) sets close-on-exec on the pty master and opens the slave with O_CLOEXEC. The child still gets the terminal as stdin.

Why

rustix::pty::openpt cannot set close-on-exec on macOS and the slave was opened without it, so every child a parallel test spawned during a mem call inherited the terminal and stalled for seconds at exit. hooks_go_on_without_a_working_tree_that_does_not_answer failed (session-start took ~6s) whenever lorectl's test binaries ran together; #414 fixed the other half (hooks waiting for stdin EOF).

Test

cargo test -p lorectl --test hook --test mcp --test plugin --test mem failed 2/2 with #414 alone and passes 5/5 with this. cargo test -p lorectl --no-fail-fast passes; clippy clean. Test-only change.

on_a_terminal's pty was inheritable, and openpt cannot set close-on-exec on
macOS, so every child a parallel test spawned meanwhile got the terminal and
stalled for seconds at exit. hooks_go_on_without_a_working_tree_that_does_not_answer
failed whenever lorectl's test binaries ran together.
@hsusul
hsusul merged commit 1fccbc2 into main Nov 9, 2026
5 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