Skip to content

Commit

Permalink
Print error upon preview command exiting without output
Browse files Browse the repository at this point in the history
  • Loading branch information
kimono-koans committed Nov 20, 2023
1 parent c76d822 commit c2f7d47
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/previewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,15 @@ fn run(rx_preview: Receiver<PreviewEvent>, on_return: Box<dyn Fn(Vec<AnsiString>
let callback_clone = callback.clone();
let thread = thread::spawn(move || {
wait(spawned, move |lines| {
let output = if lines.is_empty() {
vec![AnsiString::parse(
format!("Command exited successfully, but output was empty: {}", cmd).as_str(),
)]
} else {
lines
};
stopped_clone.store(true, Ordering::SeqCst);
callback_clone(lines, pos);
callback_clone(output, pos);
})
});
preview_thread = Some(PreviewThread {
Expand Down

0 comments on commit c2f7d47

Please sign in to comment.