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

Refactor: redirection of IO in EntryPoint #136

Open
danglotb opened this issue Mar 9, 2022 · 0 comments
Open

Refactor: redirection of IO in EntryPoint #136

danglotb opened this issue Mar 9, 2022 · 0 comments

Comments

@danglotb
Copy link
Member

danglotb commented Mar 9, 2022

It looks like there is a clash between the management of the redirection of the IO

if (EntryPoint.verbose) {
// Redirecting to given output stream
if (EntryPoint.outPrintStream != null) {
pb.redirectOutput(Redirect.PIPE);
pb.redirectError(Redirect.PIPE);
} else {
// Redirecting to main process IO (System out/err)
pb.inheritIO();
}
} else {
// Redirecting to null file is required to avoid thread deadlocks (when verbose
// is disabled)
pb.redirectOutput(File.createTempFile("test-runner-error", ".tmp"))
.redirectErrorStream(true);
}
process = pb.start();
if (EntryPoint.verbose && EntryPoint.outPrintStream != null) {
inheritIO(process.getInputStream(), EntryPoint.outPrintStream);
inheritIO(process.getErrorStream(), EntryPoint.outPrintStream);
}

The condition EntryPoint.verbose && EntryPoint.outPrintStream != null is checked twice and has two different bodies.

pb.redirectOutput(Redirect.PIPE);
pb.redirectError(Redirect.PIPE);

vs

inheritIO(process.getInputStream(), EntryPoint.outPrintStream); 
inheritIO(process.getErrorStream(), EntryPoint.outPrintStream); 
@danglotb danglotb changed the title fix: redirection of IO in EntryPoint Refactor: redirection of IO in EntryPoint Mar 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant