Skip to main content

open_editor

Function open_editor 

Source
pub fn open_editor(path: &Path) -> Result<()>
Expand description

Open a file in the user’s configured editor.

Reads the $EDITOR environment variable and spawns a subprocess with the file path. Waits for the editor to exit and validates the exit status.

§Arguments

  • path - Path to the file to edit

§Returns

  • Ok(()) if editor exits successfully (status 0)
  • Err if:
    • $EDITOR environment variable is not set
    • Editor executable is not found
    • Editor process exits with non-zero status
    • Editor subprocess crashes

§Examples

open_editor(Path::new(".beans/1-my-task.md"))?;