8000 Handle empty device list in frida-ls-devices by Qrytics · Pull Request #215 · frida/frida-tools · GitHub
[go: up one dir, main page]

Skip to content

Handle empty device list in frida-ls-devices - #215

Open
Qrytics wants to merge 1 commit into
frida:mainfrom
Qrytics:pilot/slot-690-fix
Open

Qrytics wants to merge 1 commit into
frida:mainfrom
Qrytics:pilot/slot-690-fix

Conversation

@Qrytics
@Qrytics Qrytics commented Nov 10, 2026
Copy link
Copy Markdown

What

frida-ls-devices crashed with a raw ValueError traceback when no
devices are attached (e.g. no USB device and no remote endpoint):

$ frida-ls-devices
Traceback (most recent call last):
  ...
ValueError: max_workers must be greater than 0

Fix

_print_devices in frida_tools/lsd.py no longer builds a
ThreadPoolExecutor with max_workers=0: an empty device list skips
the OS-query fan-out and goes straight to the existing table rendering,
which prints the header and exits 0:

$ frida-ls-devices
Id  Type  Name  OS
--  ----  ----  --

Seven added lines; the non-empty path is untouched.

Tests

  • Added TestLSD::test_list_no_devices_prints_header to
    tests/test_lsd.py (same mock style as the existing test):
    enumerate_devices returns [], asserts exit 0 and the exact
    header output.
  • Fail-before observed: ValueError: max_workers must be greater than 0
    propagates out of lsd.main().
  • python -m pytest tests/test_lsd.py tests/test_ps.py -q in a venv
    with the repo-pinned deps (websockets>=13,<14, frida 17.26,
    prompt-toolkit, pygments, colorama) — 6 passed. (The machine's
    system env carries websockets 10.4, which predates the
    websockets.asyncio module the repo requires, so the venv was used
    for verification; no repo dependency was changed.)

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

1 participant

0