mirror of
https://github.com/wez/wezterm.git
synced 2024-11-23 15:04:36 +03:00
wezterm: improve error reporting in imgcat
This just includes the filename in the error message if we're unable to read a file.
This commit is contained in:
parent
7d843c6b24
commit
b2dcc233c0
@ -1,4 +1,4 @@
|
||||
use anyhow::anyhow;
|
||||
use anyhow::{anyhow, Context};
|
||||
use config::wezterm_version;
|
||||
use mux::activity::Activity;
|
||||
use mux::pane::PaneId;
|
||||
@ -136,7 +136,8 @@ impl ImgCatCommand {
|
||||
fn run(&self) -> anyhow::Result<()> {
|
||||
let mut data = Vec::new();
|
||||
if let Some(file_name) = self.file_name.as_ref() {
|
||||
let mut f = std::fs::File::open(file_name)?;
|
||||
let mut f = std::fs::File::open(file_name)
|
||||
.with_context(|| anyhow!("reading image file: {:?}", file_name))?;
|
||||
f.read_to_end(&mut data)?;
|
||||
} else {
|
||||
let mut stdin = std::io::stdin();
|
||||
|
Loading…
Reference in New Issue
Block a user