Repository navigation
lsd: Print plain table when not on a terminal - #206
Open
Cassian433 wants to merge 1 commit into
Open
Cassian433 wants to merge 1 commit into
Cassian433 wants to merge 1 commit into
Conversation
With stdin redirected, Application.run() fails with EOFError, and with stdout piped we emit every spinner frame. Print a plain table instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #200.
frida-ls-devices always starts the prompt_toolkit Application. With stdin from /dev/null, as in CI, run() raises EOFError and the reactor thread then fails in _on_stop():
Exit status 1 and no table. With only stdout piped it exits 0, but every spinner frame and redraw ends up in the output.
When _have_terminal is false or TERM=none (same check as ps.py), lsd now skips the Application, queries the devices in parallel and prints the same Id/Type/Name/OS table. The OS string formatting moved into _query_os() so both paths share it. Ctrl+C cancels the pending queries like a key press does in the UI.
frida-ls-devices < /dev/nullnow prints the table and exits 0,| cat -Ashows the table with no ^M or escape codes, and the UI on a pty is unchanged. tests/test_lsd.py runs main() against fake devices with a non-TTY stdin; it fails on main with the EOFError above and passes here. Tested on Ubuntu 24.04, Python 3.12, frida 17.23.3, prompt_toolkit 3.0.53.#160 looks like a separate startup race on a real terminal and isn't touched here.