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

Subprocess does not freeze when it generates a lot of output to stdout #9550

Merged
merged 1 commit into from
Mar 27, 2024

Conversation

Akirathan
Copy link
Member

@Akirathan Akirathan commented Mar 26, 2024

Fixes #9549

Pull Request Description

According to this SO answer, one has to first read the streams from java.lang.Process before calling process.waitFor(). Otherwise, the current thread will block. I have encountered this when I tried to invoke a subprocess via System.Process.run that generates a long output to its stdout.

Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

@Akirathan Akirathan self-assigned this Mar 26, 2024
@Akirathan Akirathan added the CI: No changelog needed Do not require a changelog entry for this PR. label Mar 26, 2024
@enso-bot enso-bot bot mentioned this pull request Mar 26, 2024
@Akirathan
Copy link
Member Author

I tested it locally by invoking a subprocess that generates a lot of output. Any ideas for a unit test?

@Akirathan Akirathan merged commit 8f78668 into develop Mar 27, 2024
40 of 42 checks passed
@Akirathan Akirathan deleted the wip/akirathan/9549-subprocess-freeze branch March 27, 2024 17:01
@enso-bot enso-bot bot mentioned this pull request Mar 27, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Process.run freezes if the subprocess generates a lot of output
2 participants