Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic: reached end of file before reaching end identifier #102

Open
aidalgol opened this issue Feb 4, 2023 · 3 comments
Open

panic: reached end of file before reaching end identifier #102

aidalgol opened this issue Feb 4, 2023 · 3 comments

Comments

@aidalgol
Copy link

aidalgol commented Feb 4, 2023

I'm trying to use termshot to capture Nushell output, and it panics.

./result/bin/termshot nuls
╭────┬────────────────────────┬─────────┬────────┬───────────────╮
│  # │          name          │  type   │  size  │   modified    │
├────┼────────────────────────┼─────────┼────────┼───────────────┤
│  0 │ CONTRIBUTING.md        │ file    │ 8.4 KB │ 8 hours ago   │
│  1 │ COPYING                │ file    │ 1.1 KB │ 8 hours ago   │
│  2 │ README.md              │ file    │ 6.2 KB │ 2 months ago  │
│  3 │ default.nix            │ file    │  971 B │ a year ago    │
│  4 │ doc                    │ dir     │   23 B │ 8 hours ago   │
│  5 │ flake.nix              │ file    │ 2.3 KB │ 2 months ago  │
│  6 │ lib                    │ dir     │   34 B │ 8 hours ago   │
│  7 │ maintainers            │ dir     │    5 B │ 8 hours ago   │
│  8 │ nixos                  │ dir     │   13 B │ 8 hours ago   │
│  9 │ pkgs                   │ dir     │   18 B │ a year ago    │
│ 10 │ result                 │ symlink │   58 B │ 5 minutes ago │
│ 11 │ update-git-commits.txt │ file    │  740 B │ 2 months ago  │
╰────┴────────────────────────┴─────────┴────────┴───────────────╯exit
panic: reached end of file before reaching end identifier

goroutine 1 [running]:
github.com/gonvenience/bunt.ParseStream.func2(0x7)
	github.com/gonvenience/[email protected]/parse.go:100 +0x88
github.com/gonvenience/bunt.ParseStream.func4()
	github.com/gonvenience/[email protected]/parse.go:172 +0xb8
github.com/gonvenience/bunt.ParseStream({0x6db758?, 0xc00018eb70?}, {0x0, 0x0, 0xc0001e7000?})
	github.com/gonvenience/[email protected]/parse.go:225 +0x4ed
github.com/homeport/termshot/internal/img.(*Scaffold).AddContent(0xc000181bd0, {0x6db758?, 0xc00018eb70?})
	github.com/homeport/termshot/internal/img/output.go:116 +0x39
github.com/homeport/termshot/internal/cmd.glob..func1(0x9778e0?, {0xc0000b33d0?, 0x1, 0x1})
	github.com/homeport/termshot/internal/cmd/root.go:115 +0x4d0
github.com/spf13/cobra.(*Command).execute(0x9778e0, {0xc000016050, 0x1, 0x1})
	github.com/spf13/[email protected]/command.go:916 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0x9778e0)
	github.com/spf13/[email protected]/command.go:1040 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/[email protected]/command.go:968
github.com/homeport/termshot/internal/cmd.Execute()
	github.com/homeport/termshot/internal/cmd/root.go:144 +0x67
main.main()
	github.com/homeport/termshot/cmd/termshot/main.go:26 +0x17

This is with v0.2.5 of termshot.

@QuinnyPig
Copy link

Just ran into the same thing.

@siiick
Copy link

siiick commented Feb 2, 2024

same issue I ran termshot /bin/zsh to begin the capture sequence

@llimllib
Copy link

llimllib commented May 3, 2024

At least in my case, the error is caused by having OSC8 hyperlinks in the output stream.

One way to reliably cause this failure is to use eza:

# this works fine, without hyperlinks:
$ termshot -c -- eza            
bin  dist  git-ls  go.mod  LICENSE  main.go  Makefile  out.png  README.md  static

# this doesn't, with hyperlinks:
$ termshot -c -- eza --hyperlink                                                             
bin  dist  git-ls  go.mod  LICENSE  main.go  Makefile  out.png  README.md  static
panic: reached end of file before reaching end identifier

goroutine 1 [running]:
github.com/gonvenience/bunt.ParseStream.func2(0x7)
	github.com/gonvenience/[email protected]/parse.go:100 +0x9c
github.com/gonvenience/bunt.ParseStream.func4()
	github.com/gonvenience/[email protected]/parse.go:172 +0xac
github.com/gonvenience/bunt.ParseStream({0x1044a2738?, 0x1400016abd0?}, {0x0, 0x0, 0x140001cc000?})
	github.com/gonvenience/[email protected]/parse.go:225 +0x3b0
github.com/homeport/termshot/internal/img.(*Scaffold).AddContent(0x14000123bb8, {0x1044a2738?, 0x1400016abd0?})
	github.com/homeport/termshot/internal/img/output.go:118 +0x3c
github.com/homeport/termshot/internal/cmd.glob..func1(0x104738a80?, {0x14000132340?, 0x2, 0x4})
	github.com/homeport/termshot/internal/cmd/root.go:120 +0x39c
github.com/spf13/cobra.(*Command).execute(0x104738a80, {0x1400010c060, 0x4, 0x4})
	github.com/spf13/[email protected]/command.go:940 +0x5c8
github.com/spf13/cobra.(*Command).ExecuteC(0x104738a80)
	github.com/spf13/[email protected]/command.go:1068 +0x35c
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/[email protected]/command.go:992
github.com/homeport/termshot/internal/cmd.Execute()
	github.com/homeport/termshot/internal/cmd/root.go:162 +0x64
main.main()
	./main.go:26 +0x1c

May be related to gonvenience/bunt#48

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants