mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 21:35:54 +03:00
[GH-ISSUE #556] ANSI example cannot run due to panic #407
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#407
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @tculp on GitHub (Jan 26, 2021).
Original GitHub issue: https://github.com/rivo/tview/issues/556
If trying to run the ANSI example (https://github.com/rivo/tview/wiki/ANSI), the code panics on line 25:
Even
echo 'hello' | go run main.gofails with the same panic.I have confirmed this behavior both in a fresh container, and natively.
OS: MacOS
Terminal: iTerm2
Go version(s):
@rivo commented on GitHub (Feb 17, 2021):
I cannot reproduce this. I just tried it on macOS with iTerm2. I'm not sure this has something to do with
tviewbut rather with how pipes work in your environment. Maybe you can google this error message and find out a bit more about that message? It could give us a hint of where to look.@tculp commented on GitHub (Feb 22, 2021):
Have you tried my steps using docker? I still get this consistently both in docker and locally. Pipes shouldn't work any differently for my environment.
This other project seemed to have a similar error: https://github.com/c-bata/go-prompt/issues/88
@neezer commented on GitHub (Mar 15, 2021):
@rivo In testing out a new version as you suggested for https://github.com/rivo/tview/issues/542, I ran into this same issue.
The version before the bump does not panic with this error.
@rivo commented on GitHub (Mar 15, 2021):
I don't have Docker on my Mac so it'll take me a little bit to try this. In the meantime, could you let me know if the following program gives you the same error?
(I know this has appeared with newer
tviewversions but it's worth a shot.) It's a bit odd that there's no callstack. I also couldn't find any useful information when googling this error message.@neezer commented on GitHub (Mar 15, 2021):
This might be relevant: https://github.com/gdamore/tcell/issues/432 (suspect because of
github.com/rivo/tview@745e4ceeb7)Running the snippet from that issue does give me the same error.
Your code snippet works fine for me (no error). FWIW I get the initial error running locally (not in Docker) in my repo.
@rivo commented on GitHub (Mar 15, 2021):
Good catch. I'm prettty sure this is the same as https://github.com/gdamore/tcell/issues/432 as I'm basically doing the same thing in
tview.@neezer commented on GitHub (Mar 15, 2021):
I'm guessing this change is the underlying cause. It fits the timeline. Given the author doesn't want to revert behavior but instead has some future plan, I'm not sure where to go from here.
What's the recourse for
tview? I can reproduce @tculp 's original issue locally on macOS and inside Docker using their instructions, and my app (which operates on piped input from stdin in a similar way) is also broken.@mevdschee commented on GitHub (Mar 16, 2021):
Like @neezer I can reproduce the issue in tview and tcell and not in the go-only example (on Ubuntu).
@rivo commented on GitHub (Mar 16, 2021):
@neezer, I'm not sure what to do here. If
tcelloccupiesos.Stdin, I can't work around that intview. As soon as @gdamore lets us know how we can read input from a pipe, I'll update the Wiki example. As for your application, if there are no alternatives for you, I would suggest that you revert to a previous commit oftviewfor the time being. As I mention in various places (and in the README), I'm trying to keeptviewbackwards-compatible. So you should be able to upgrade easily once a solution has been found.@rivo commented on GitHub (Aug 2, 2021):
Is this still an issue? I can run the ANSI example on my Mac as described and it works.
If this still doesn't work for some configurations, a solution I found was to use temporary named pipes instead of relying on
os.Stdin:Then you can do this:
Please let me know if this issue is resolved or not. If it's not resolved, I'll update the Wiki accordingly.
@mevdschee commented on GitHub (Aug 2, 2021):
I tested the latest versions of tview and tcell and this issue is resolved now. This code:
works now*! No need for a workaround. Versions in go.sum:
Thank you for your hard work!
*) it may require tcell v2.2.1 or up (see: https://github.com/gdamore/tcell/issues/432)
@rivo commented on GitHub (Aug 2, 2021):
Great! Thanks for the feedback.