Closed LangLangBart closed 2 weeks ago
man fzf
fzf --version
0.53.0 (brew)
Since commit 83b603390683d49ff75b72d142b4dba4b5186d73 (main.go), I noticed a panic when killing a script, where fzf runs.
main.go
panic
fzf
--- a/main.go +++ b/main.go @@ -36,5 +36,5 @@ func printScript(label string, content []byte) { func exit(code int, err error) { - if err != nil { + if code == fzf.ExitError { fmt.Fprintln(os.Stderr, err.Error()) }
Run this small script in a terminal tab; the $$ is copied to your clipboard (macOS only).
$$
#!/usr/bin/env bash echo $$ | pbcopy : | FZF_DEFAULT_OPTS="" fzf
In a second terminal tab, run the following:
kill -15 <copied_pid>
Examine the first terminal tab and notice the panic.
panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xb286143] goroutine 1 [running]: main.exit(0x2, {0x0?, 0x0?}) github.com/junegunn/fzf/main.go:39 +0x23 main.main() github.com/junegunn/fzf/main.go:81 +0x198
Maybe check for nil or have a dedicated message for nil?
if code == fzf.ExitError && err != nil
Thanks, nice find.
Checklist
man fzf
)Output of
fzf --version
0.53.0 (brew)
OS
Shell
Problem / Steps to reproduce
Since commit 83b603390683d49ff75b72d142b4dba4b5186d73 (
main.go
), I noticed apanic
when killing a script, wherefzf
runs.to reproduce
Run this small script in a terminal tab; the
$$
is copied to your clipboard (macOS only).In a second terminal tab, run the following:
Examine the first terminal tab and notice the panic.
possible solution
Maybe check for nil or have a dedicated message for nil?