Skip to content

Refactor: redirection of IO in EntryPoint #136

Description

@danglotb

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); 

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions