Files
pacdef_rust/crates/pacdef_core/src/cmd.rs
T
steven-omaha 83c05be3d3 refactor get_assumed_group_file_names
is now called get_group_file_paths_matching_args
2023-02-15 13:50:56 +01:00

20 lines
534 B
Rust

use std::path::Path;
use std::process::{Command, ExitStatus};
use anyhow::{anyhow, Context, Result};
use crate::env::get_editor;
pub fn run_edit_command(files: &[&Path]) -> Result<ExitStatus> {
let mut cmd = Command::new(get_editor().context("getting suitable editor")?);
cmd.current_dir(
files[0]
.parent()
.context("getting parent dir of first file argument")?,
);
for f in files {
cmd.arg(f.to_string_lossy().to_string());
}
cmd.status().map_err(|e| anyhow!(e))
}