Procházet zdrojové kódy

tau: Add a more informational error if $EDITOR or xdg-open aren't found.

parazyd před 3 roky
rodič
revize
b2db6c190d
1 změnil soubory, kde provedl 4 přidání a 1 odebrání
  1. 4 1
      bin/tau/tau-cli/src/util.rs

+ 4 - 1
bin/tau/tau-cli/src/util.rs

@@ -85,7 +85,10 @@ pub fn prompt_text(task_info: TaskInfo, what: &str) -> Result<Option<String>> {
         Err(_) => "xdg-open".into(),
     };
 
-    Command::new(editor_argv0).arg(&file_path).status()?;
+    if let Err(e) = Command::new(editor_argv0).arg(&file_path).status() {
+        error!("Running $EDITOR failed, neither env or xdg-open are available");
+        return Err(e.into())
+    }
 
     // Whatever has been written in the temp file will be read here.
     let content = fs::read_to_string(&file_path)?;