-
Notifications
You must be signed in to change notification settings - Fork 32
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
Crash when piping to a pager like less, bat #86
Comments
Hi @bb and thanks for reporting the issue. |
Yes. Works with any consumer which reads to the end, e.g. cat. Fails with those who only read part of the output, e.g. less (assuming output is longer than screen height. Otherwise less reads all of it and it works). |
Just noticed I only answered one of the two question. I worked with geojson files from https://osm-boundaries.com/Map. But the actual file does not matter, as long as it's longer than the screen size and bigger than some internal buffer. The geojson files need OSM login, but there here are two examples of (non-geojson) json data: This fails: While this works: |
Yeah, the problem is that jql reads the whole piped content in memory and expect it to be valid JSON. |
@bb sorry for the late reply! I was checking again and indeed They mentioned multiple workarounds including this one used by Since it's using |
@yamafaktory thanks for following up. No need to worry or feel sorry. Honestly, I finished the stuff I was using jql for and don't need it now or anytime soon. So it's absolutely not critical nor urgent for me... My workaround was to press Shift-G in less so it scrolls to the end and thus prevents the crash. |
@yamafaktory You might want to try the approach similar to crev-dev/cargo-crev@3f3dedf (as discussed in crev-dev/cargo-crev#287). No unsafe there. |
@yerke I guess this is what I mentioned a while ago here #86 (comment) |
@yerke nevermind this was just one of the links, I see what you mean (commit). |
I'm going to release a new version soon, thanks @yerke! Looking good now: https://asciinema.org/a/465294. |
@bb A new version has been released. Don't hesitate to re-open the issue if the fix doesn't work has expected (works for me locally and in the CI). |
jql crashes for me when piping the output to a pager like less or bat and the output is not fully read (because it's longer than the viewport). I'm running version 2.9.3. installed via brew on macos (latest version).
This works as it only provides very few lines of output for my example file:
However, when outputting a bit more, it crashes when I quit the pager without scrolling to the end:
When I scroll the
less
to the end (e.g. by pressingG
key) or when I pipe tocat
which also reads everything, there's no issue.Please let me know when you need more information.
The text was updated successfully, but these errors were encountered: