Skip to content

fix(hook): drop tee capture and use tcgetpgrp for fg process#16

Merged
moukrea merged 1 commit intomainfrom
fix/hook-transparent-registration
Apr 14, 2026
Merged

fix(hook): drop tee capture and use tcgetpgrp for fg process#16
moukrea merged 1 commit intomainfrom
fix/hook-transparent-registration

Conversation

@moukrea
Copy link
Copy Markdown
Owner

@moukrea moukrea commented Apr 14, 2026

Summary

  • Drop tee-based capture from hook: exec > >(tee ...) made stdout a pipe, breaking isatty() — TUI apps (nano, vim) couldn't initialize ncurses properly and keyboard shortcuts failed. The hook now only exports SNAG_SESSION with zero side effects. snag ls/cwd/ps/attach/send all work via /proc and the stolen master fd.

  • Use tcgetpgrp for FG process: replaces the /proc scan heuristic (which picked up background tee as the FG process) with nix::unistd::tcgetpgrp(master_fd) — the kernel's authoritative answer for the foreground process group. Shows idle at prompt, actual command name when running something.

@moukrea moukrea merged commit ec8f7cd into main Apr 14, 2026
4 checks passed
@moukrea moukrea deleted the fix/hook-transparent-registration branch April 14, 2026 09:54
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