Added InputStreamCollector by ralfgrossklaus · Pull Request #50 · diffplug/goomph
Multithreaded way to collect inputStreams of started process in order to prevent deadlocks when buffer for StdErr is full while parent process still tries to read from StdOut.
|
|
||
| private volatile IOException exception; | ||
|
|
||
| public InputStreamCollector(@Nonnull InputStream is, @Nullable PrintStream ps, @Nullable Charset cs) { |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we assume that things are @Nonnull by default, similarly to how Guava and Checker Framework approach things, so I'd vote to have this instance of @Nonnull removed.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm OK with that.
| } else if (exitValue != EXIT_VALUE_SUCCESS) { | ||
| throw new RuntimeException("'" + cmd + "' exited with " + exitValue); | ||
| } | ||
|
|
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noted this issue: Maybe it's not the best idea to re-throw exceptions from another thread without wrapping them, since the stacktrace of the exception won't match to the thread that throws it :-/
- Wrapped exceptions from other threads - Removed unnecessary @nonnull
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