Added InputStreamCollector by ralfgrossklaus · Pull Request #50 · diffplug/goomph

@ralfgrossklaus

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.

@ralfgrossklaus

Multithreaded way to collect inputStreams

jbduncan


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.

ralfgrossklaus

} 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 :-/

@ralfgrossklaus

- Wrapped exceptions from other threads
- Removed unnecessary @nonnull

@nedtwigg