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

Unable to diff two file descriptors #232

Open
danvk opened this issue Oct 31, 2024 · 1 comment
Open

Unable to diff two file descriptors #232

danvk opened this issue Oct 31, 2024 · 1 comment
Labels

Comments

@danvk
Copy link
Owner

danvk commented Oct 31, 2024

I'd expect webdiff <(cmd1) <(cmd2) to work, but it seems not to:

$ webdiff <(jq . /tmp/base-ll.js) <(jq . data/nyc-lat-lons-ny.js)
Serving diffs on http://localhost:59027
Close the browser tab or hit Ctrl-C when you're done.
======== Running on http://localhost:59027 ========
(Press CTRL+C to quit)
grep: /dev/fd/12: Bad file descriptor
Error handling request
Traceback (most recent call last):
  File "/Users/danvk/.local/pipx/venvs/webdiff/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/danvk/.local/pipx/venvs/webdiff/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/danvk/.local/pipx/venvs/webdiff/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/danvk/.local/pipx/venvs/webdiff/lib/python3.12/site-packages/webdiff/app.py", line 200, in request_time_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/danvk/.local/pipx/venvs/webdiff/lib/python3.12/site-packages/webdiff/app.py", line 124, in handle_diff_ops
    dataclasses.asdict(op) for op in diff.get_diff_ops(DIFF[idx], options)
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/danvk/.local/pipx/venvs/webdiff/lib/python3.12/site-packages/webdiff/diff.py", line 52, in get_diff_ops
    num_lines = fast_num_lines(b_path)
                ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/danvk/.local/pipx/venvs/webdiff/lib/python3.12/site-packages/webdiff/diff.py", line 39, in fast_num_lines
    return int(subprocess.check_output(['grep', '-c', '', path]))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['grep', '-c', '', '/dev/fd/12']' returned non-zero exit status 2.
Shutting down...
@danvk danvk added the bug label Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants
@danvk and others