pub fn spawn_editor(template: &str) -> Result<String>Expand description
Spawn the user’s editor on a tempfile pre-populated with template,
then read the file back, strip #-comment lines, and return the
trimmed result.
The editor is chosen in this order:
$GIT_EDITOR$EDITOR$VISUAL- platform default (
vion Unix,notepadon Windows)
The editor invocation parses the chosen value as a shell-like
command: the first whitespace-separated token is the program, the
rest are arguments, and the tempfile path is appended as a final
argument. This matches how git’s GIT_EDITOR is conventionally
parsed (e.g. EDITOR="vim -c 'set nowrap'").
§Errors
io::ErrorKind::NotFoundif the editor binary cannot be spawned.io::ErrorKind::Otherwith a descriptive message if the editor exits non-zero or the file exceedsMAX_COMMIT_MSG_BYTES.