summaryrefslogtreecommitdiffstats
path: root/src/utils/command.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/command.rs')
-rw-r--r--src/utils/command.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/utils/command.rs b/src/utils/command.rs
index 873e40b..557649a 100644
--- a/src/utils/command.rs
+++ b/src/utils/command.rs
@@ -1,4 +1,4 @@
-use std::{collections::HashMap, env, ffi::OsStr, process::Command};
+use std::{collections::HashMap, env, ffi::OsStr, path::Path, process::Command};
use anyhow::{Context, Result};
@@ -90,3 +90,9 @@ pub fn run_command_with_output<T: AsRef<OsStr>>(
let stderr = std::str::from_utf8(&output.stderr).context("Invalid UTF-8 in stderr")?;
Ok((status.success(), stdout.to_string(), stderr.to_string()))
}
+
+pub fn edit_file(editor: &str, path: &Path) -> Result<()> {
+ let mut child = Command::new(editor).arg(path).spawn()?;
+ child.wait()?;
+ Ok(())
+}