Explorar el Código

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

parazyd hace 3 años
padre
commit
b2db6c190d
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  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)?;