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

chore: Print error logs from the RPC subprocess #10238

Closed
wants to merge 1 commit into from
Closed

Conversation

nmote
Copy link
Collaborator

@nmote nmote commented May 10, 2024

Test plan:

  • Automated tests
  • Add prerr_endline "HELLO WORLD"; to the beginning of the RPC.main function. Run an autofix rule with --autofix and observe the autofix get correctly applied and observe "HELLO WORLD" in the output of pysemgrep.

Test plan:

* Automated tests
* Add `prerr_endline "HELLO WORLD";` to the beginning of the `RPC.main`
  function. Run an autofix rule with `--autofix` and observe the autofix
  get correctly applied and observe "HELLO WORLD" in the output of
  pysemgrep.
@nmote nmote requested review from aryx and amchiclet May 10, 2024 22:21
Copy link
Contributor

github-actions bot commented May 10, 2024

PR checklist:

  • Purpose of the code is evident to future readers
  • Tests included or PR comment includes a reproducible test plan
  • Documentation is up-to-date
  • A changelog entry was added to changelog.d for any user-facing change
  • Change has no security implications (otherwise, ping security team)

If you're unsure about any of this, please see:

@nmote
Copy link
Collaborator Author

nmote commented May 10, 2024

Not sure what was going on with #10196. Maybe the logs were getting printed on stderr instead of stdout in the OCaml process? If so, that needs to get sorted out.

@aryx
Copy link
Collaborator

aryx commented May 10, 2024

logs are printed on stderr.

@nmote
Copy link
Collaborator Author

nmote commented May 10, 2024

Looks like a bunch of e2e-pro autofix tests are failing

@nmote
Copy link
Collaborator Author

nmote commented May 10, 2024

I'm seeing:

  File "/usr/lib/python3.10/subprocess.py", line 1657, in _get_handles
    errwrite = stderr.fileno()
io.UnsupportedOperation: fileno

My suspicion right now is that pytest is mocking sys.stderr in such a way that the fileno() method is not implemented.

@aryx
Copy link
Collaborator

aryx commented May 11, 2024

hmm, probably yes. Pytest is doing lots of things under the hood ...
we've been bitten by it before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

2 participants