Sfoglia il codice sorgente

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

parazyd 3 anni fa
parent
commit
b2db6c190d
1 ha cambiato i file con 4 aggiunte e 1 eliminazioni
  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)?;