Expand description
Opening the user’s text editor on a file and waiting for it to close.
The fallback editor list differs per OS (vim/nano/vi against
edit/notepad). As in crate::browser, the platform selection is a
pure function taking the OS string, the candidate list and argv split are
pure, and the actual process run is injected - so nothing here needs a
#[cfg] and every branch is reachable under test on a single platform.
What is not here is anything about what the file contains. Building the
task template, stripping its comment lines and deciding whether an empty
result cancels the run are Leviath policy, not OS behavior, and live in
leviath-cli.
Enums§
- Editor
RunOutcome - Outcome of running one editor candidate, abstracting over the raw
ExitStatus. This exists so the “ran but ended with no exit code” case (a signal kill on Unix) is injectable in tests on every platform: on Windows anExitStatusalways carries a code (even viaExitStatusExt::from_raw), so that case cannot be fabricated from a status directly. The injectedrunseam oflaunch_viatherefore yields this enum rather than anExitStatus.
Functions§
- classify_
exit - Classify an editor subprocess’s exit.
code == Nonemeans it ended without an exit code (a signal kill). A pure function so both arms are unit-testable on every platform, independent of whether a real process can produce a code-less status there. - default_
editors_ for - The fallback editor candidates for
os, tried in order after any$VISUAL/$EDITORvalue. - editor_
argv - Split one candidate into a program and its arguments, with
pathappended. - editor_
candidates - The full candidate list in priority order:
$VISUAL, then$EDITOR, then the platform fallbacks foros. - launch
- Launch the user’s editor on
pathand wait for it to close. - launch_
via - Try each candidate in order and return once one runs to completion.