Skip to content

Commit

Permalink
utils: Use run helper for editor
Browse files Browse the repository at this point in the history
I just happened to glance at this code, this gives us stderr
in the error, etc.

Signed-off-by: Colin Walters <[email protected]>
  • Loading branch information
cgwalters committed Dec 6, 2024
1 parent 62e186d commit fa9a992
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,12 @@ pub(crate) fn spawn_editor(tmpf: &tempfile::NamedTempFile) -> Result<()> {
let argv0 = editor_args
.next()
.ok_or_else(|| anyhow::anyhow!("Invalid editor: {editor}"))?;
let status = Command::new(argv0)
Command::new(argv0)
.args(editor_args)
.arg(tmpf.path())
.lifecycle_bind()
.status()
.context("Spawning editor")?;
if !status.success() {
anyhow::bail!("Invoking editor: {editor} failed: {status:?}");
}
Ok(())
.run()
.with_context(|| format!("Invoking editor {editor} failed"))
}

/// Convert a combination of values (likely from CLI parsing) into a signature source
Expand Down

0 comments on commit fa9a992

Please sign in to comment.