wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
16.75k stars 751 forks source link

`wezterm imgcat` crashes when running in tmux #5522

Open hktonylee opened 3 months ago

hktonylee commented 3 months ago

What Operating System(s) are you seeing this problem on?

macOS

Which Wayland compositor or X11 Window manager(s) are you using?

No response

WezTerm version

20240203-110809-5046fc22

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

I create a tmux session first. (tmux)

Then run this command in the tmux session /Applications/WezTerm.app/Contents/MacOS/wezterm imgcat ~/Desktop/Shell\ Init\ Scripts.png

It will throw the following error

11:04:32.657  ERROR  env_bootstrap > panic at wezterm/src/main.rs:383:10 - attempt to divide by zero
   0: backtrace::capture::Backtrace::create
   1: backtrace::capture::Backtrace::new
   2: env_bootstrap::register_panic_hook::{{closure}}
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic_handler::{{closure}}
   5: std::sys_common::backtrace::__rust_end_short_backtrace
   6: _rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::panicking::panic
   9: wezterm::ImgCatCommand::compute_image_cell_dimensions
  10: wezterm::run
  11: wezterm::main
  12: std::sys_common::backtrace::__rust_begin_short_backtrace
  13: std::rt::lang_start::{{closure}}
  14: std::rt::lang_start_internal
  15: std::rt::lang_start
  16: _main

thread 'main' panicked at wezterm/src/main.rs:383:10:
attempt to divide by zero
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Re-run with RUST_BACKTRACE=full will show this:

image

To Reproduce

No response

Configuration

no config

Expected Behavior

It shouldn't crash I guess

Logs



Anything else?

No response

ArchWand commented 3 months ago

Hi, to my understanding it looks like this should only happen if either the image or the terminal has a height and/or width of 0; can you upload the image you used as well?

hktonylee commented 1 month ago

(It seems my previous comment failed to upload :( I just checked and realized this)

This is the image. A normal PNG. I can display it with wezterm imgcat when it's not in tmux session.

Shell Init Scripts