Skip to content

Commit c1ec910

Browse files
committed
Handle errors when launching EDITOR better
1 parent 38f6942 commit c1ec910

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/app.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,18 @@ impl App {
9898
let mut tui = terminal.tui.lock().await;
9999
tui.exit()?;
100100
let editor = std::env::var("EDITOR").unwrap_or_else(|_| "nano".to_string());
101-
match Command::new(editor).arg(path).status() {
101+
match Command::new(&editor).arg(path).status() {
102102
Ok(_) => {
103103
tui.enter()?;
104104
tui.clear()?;
105105
event = EventHandler::new(self.home.clone(), action_tx.clone());
106106
action_tx.send(Action::EnterMode(Mode::ServiceList))?;
107107
},
108108
Err(e) => {
109-
action_tx.send(Action::EnterError(format!("Failed to open editor: {}", e)))?;
109+
tui.enter()?;
110+
tui.clear()?;
111+
event = EventHandler::new(self.home.clone(), action_tx.clone());
112+
action_tx.send(Action::EnterError(format!("Failed to open editor `{}`: {}", editor, e)))?;
110113
},
111114
}
112115
},

0 commit comments

Comments
 (0)