walles / moar

Moar is a pager. It's designed to just do the right thing without any configuration.
Other
675 stars 19 forks source link

panic detected when use moar for git diff #214

Closed haunt98 closed 5 months ago

haunt98 commented 5 months ago

I use git diff -w with moar config in ~/.zshrc

# https://github.com/walles/moar
if command -v moar &>/dev/null; then
    export MOAR="-no-linenumbers -no-statusbar -quit-if-one-screen -wrap"
    export PAGER=moar
fi
Version: v1.24.1
LANG   : en_US.UTF-8
TERM   : xterm-kitty

GOOS    : darwin
GOARCH  : arm64
Compiler: gc
NumCPU  : 8

panic: write /dev/stdout: file already closed [recovered]
    panic: write /dev/stdout: file already closed

goroutine 1 [running]:
main.main.func1()
    github.com/walles/moar/moar.go:793 +0x150
panic({0x104bdb9e0?, 0x140003f2480?})
    runtime/panic.go:770 +0x124
github.com/walles/moar/twin.(*UnixScreen).write(...)
    github.com/walles/moar/twin/screen.go:198
github.com/walles/moar/twin.(*UnixScreen).showNLines(0x140001b0000, 0x14, 0xc8?)
    github.com/walles/moar/twin/screen.go:720 +0x2fc
github.com/walles/moar/twin.(*UnixScreen).ShowNLines(0x140001b0000?, 0x104c0ae50?)
    github.com/walles/moar/twin/screen.go:687 +0x20
github.com/walles/moar/m.(*Pager).ReprintAfterExit(0x14000282000)
    github.com/walles/moar/m/pager.go:472 +0x64
main.startPaging.func1()
    github.com/walles/moar/moar.go:851 +0x50
main.startPaging(0x14000098110?, {0x104c0e0b8?, 0x140001b0000?}, 0x104c09d88?, 0x14000180001?)
    github.com/walles/moar/moar.go:866 +0x6c
main.main()
    github.com/walles/moar/moar.go:818 +0x234

Dowgrade to v1.23.5 work fine

dsully commented 5 months ago

Seeing the same thing.

walles commented 5 months ago

Confirmed.

Workarounds for now is to either downgrade (as you did) or drop -quit-if-one-screen.

walles commented 5 months ago

Fixed in v1.24.2, just made a new release: https://github.com/walles/moar/releases/tag/v1.24.2

haunt98 commented 5 months ago

Thank @walles for your fast response! Thank for the good tool again!

dsully commented 5 months ago

Unfortunately that didn't work for me.

$ git show
Please post the following report at <https://github.com/walles/moar/issues>,
or e-mail it to johan.walles@gmail.com.

Version: v1.24.2
LANG   : en_US.UTF-8
TERM   : wezterm

GOOS    : darwin
GOARCH  : arm64
Compiler: gc
NumCPU  : 10

panic: write /dev/stdout: file already closed [recovered]
        panic: write /dev/stdout: file already closed

goroutine 1 [running]:
main.main.func1()
        github.com/walles/moar/moar.go:793 +0x150
panic({0x104f179e0?, 0x140003fd410?})
        runtime/panic.go:770 +0x124
github.com/walles/moar/twin.(*UnixScreen).write(...)
        github.com/walles/moar/twin/screen.go:198
github.com/walles/moar/twin.(*UnixScreen).showNLines(0x140001597a0, 0x12, 0x48?)
        github.com/walles/moar/twin/screen.go:720 +0x2fc
github.com/walles/moar/twin.(*UnixScreen).ShowNLines(0x140001597a0?, 0x104f46e50?)
        github.com/walles/moar/twin/screen.go:687 +0x20
github.com/walles/moar/m.(*Pager).ReprintAfterExit(0x14000496000)
        github.com/walles/moar/m/pager.go:472 +0x64
main.startPaging.func1()
        github.com/walles/moar/moar.go:851 +0x50
main.startPaging(0x14000010160?, {0x104f4a0b8?, 0x140001597a0?}, 0x104f45d88?, 0x14000030001?)
        github.com/walles/moar/moar.go:866 +0x6c
main.main()
        github.com/walles/moar/moar.go:818 +0x234
walles commented 5 months ago

Can you try this release?

https://github.com/walles/moar/releases/tag/v1.24.3

dsully commented 5 months ago

That works.

walles commented 5 months ago

Thanks for the confirmation @dsully!