You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Platform-aware default shell + Windows recording fixes
Default recording shell is now platform-aware (config::default_shell), used by
both Config::with_defaults() and the menu's runtime fallback:
* Unix: $SHELL, falling back to /bin/sh.
* Windows: pwsh.exe when PowerShell 7 is on PATH, else powershell.exe.
Previously with_defaults() read $SHELL on every platform, so Windows got an
empty default and fell back to /bin/sh, which does not exist there.
pwsh is preferred because aterm forwards its environment to the child: launched
from pwsh, the inherited PSModulePath points at PowerShell 7's modules, and
handing that to a Windows PowerShell 5.1 child makes it load PS7 module versions
incompatible with 5.1 — PSReadLine and even core modules fail to load ("Cannot
load PSReadline module"). Launching pwsh keeps the shell and its PSModulePath
consistent. The unused per-platform default_shell() helpers are removed.
Windows console handling for the recording (no-op on Unix):
* TerminalModeGuard enables ENABLE_VIRTUAL_TERMINAL_INPUT (and clears the
cooked-input flags) so special keys — arrows, Home/End, function keys — are
captured as VT escape sequences and forwarded to the child; ReadConsoleW
otherwise returns only typed characters and drops them. It also enables
ENABLE_VIRTUAL_TERMINAL_PROCESSING + DISABLE_NEWLINE_AUTO_RETURN so the
child's VT output (colours, cursor motion) renders instead of printing escape
bytes. The exact prior console modes are restored on drop.
* StdinPoller's reader thread gates each blocking console read behind a 50ms
WaitForSingleObject on the console input handle, so it re-checks its stop
flag and exits on its own at teardown. This keeps the thread from outliving
the recording and stealing the post-recording menu's first keystroke, and
avoids an un-interruptible read that would otherwise hang the menu until a
keypress.
These Windows console APIs have no safe-wrapper equivalent (the way rustix
covers the Unix syscalls), so the crate-wide forbid(unsafe_code) is relaxed to
deny(unsafe_code) with a single scoped, documented #[allow(unsafe_code)] on
recorder::windows; each FFI call has a SAFETY comment. Adds windows-sys as a
cfg(windows) dependency.
Verified: 164 tests pass; clippy clean on the native and x86_64-pc-windows-gnu
targets. Windows runtime behavior confirmed by the reporter (PSReadLine loads,
special keys work, exit drops straight to the menu).
0 commit comments