Report terminal command failures #654

Merged
barrettruth merged 1 commit from fix/641-terminal-failures into main 2026-05-06 22:14:04 +00:00
Owner

Closes #641

Summary

  • Checks terminal spawn return values and start exceptions from termopen().
  • Installs an on_exit callback for live terminal views and reports nonzero exits in the terminal buffer.
  • Preserves successful terminal behavior, normal-mode actions, and explicit startinsert behavior.

Messaging

Before After
failed spawn left an empty terminal buffer failed to start terminal command: terminal job did not start
terminal command had no exit callback and left no failure status terminal command exited unsuccessfully: code 2

The wording keeps the stack rule: context plus detail, no raw command disclosure, no (exit 1), and no stdout/stderr label syntax. For real terminal output, existing CLI output remains in the terminal buffer and the exit-status line is appended after it.

Repro

  • Before: system nvim with vim.pack + lz.n showed SPAWN_OPTS=nil, SPAWN_LINES=, HAS_ON_EXIT=false, and EXIT_LINES=.
  • After: same repro shows SPAWN_OPTS=table, SPAWN_LINES=failed to start terminal command: terminal job did not start, HAS_ON_EXIT=true, and EXIT_LINES=terminal command exited unsuccessfully: code 2.
  • Real terminal smoke: sh -c "echo authentication failed; exit 2" preserved authentication failed and appended terminal command exited unsuccessfully: code 2.

Verification

  • just test spec/term_spec.lua
  • nix develop .#ci --command just ci
Closes #641 ## Summary - Checks terminal spawn return values and start exceptions from `termopen()`. - Installs an `on_exit` callback for live terminal views and reports nonzero exits in the terminal buffer. - Preserves successful terminal behavior, normal-mode actions, and explicit `startinsert` behavior. ## Messaging | Before | After | |---|---| | failed spawn left an empty terminal buffer | `failed to start terminal command: terminal job did not start` | | terminal command had no exit callback and left no failure status | `terminal command exited unsuccessfully: code 2` | The wording keeps the stack rule: context plus detail, no raw command disclosure, no `(exit 1)`, and no `stdout`/`stderr` label syntax. For real terminal output, existing CLI output remains in the terminal buffer and the exit-status line is appended after it. ## Repro - Before: system nvim with vim.pack + lz.n showed `SPAWN_OPTS=nil`, `SPAWN_LINES=`, `HAS_ON_EXIT=false`, and `EXIT_LINES=`. - After: same repro shows `SPAWN_OPTS=table`, `SPAWN_LINES=failed to start terminal command: terminal job did not start`, `HAS_ON_EXIT=true`, and `EXIT_LINES=terminal command exited unsuccessfully: code 2`. - Real terminal smoke: `sh -c "echo authentication failed; exit 2"` preserved `authentication failed` and appended `terminal command exited unsuccessfully: code 2`. ## Verification - `just test spec/term_spec.lua` - `nix develop .#ci --command just ci`
Report terminal command failures
All checks were successful
quality / Test (pull_request) Successful in 13s
quality / Format (pull_request) Successful in 18s
quality / Lint (pull_request) Successful in 18s
f0bde277da
barrettruth deleted branch fix/641-terminal-failures 2026-05-06 22:14:04 +00:00
Sign in to join this conversation.
No description provided.