junit-team/junit5 · error · JUnitException

Error redirecting stdout to file: ${stdoutPath}

Error message

Error redirecting stdout to file: ${stdoutPath}

What it means

Error "Error redirecting stdout to file: ${stdoutPath}" thrown in junit-team/junit5.

Source

Thrown at junit-platform-console/src/main/java/org/junit/platform/console/command/StandardStreamsHandler.java:60

	 */
	public void redirectStandardStreams(@Nullable Path stdoutPath, @Nullable Path stderrPath) {
		if (isSameFile(stdoutPath, stderrPath)) {
			try {
				PrintStream commonStream = new PrintStream(Files.newOutputStream(stdoutPath), true);
				this.stdout = commonStream;
				this.stderr = commonStream;
			}
			catch (IOException ex) {
				throw new JUnitException("Error redirecting stdout and stderr to file: " + stdoutPath, ex);
			}
		}
		else {
			if (stdoutPath != null) {
				try {
					this.stdout = new PrintStream(Files.newOutputStream(stdoutPath), true);
				}
				catch (IOException ex) {
					throw new JUnitException("Error redirecting stdout to file: " + stdoutPath, ex);
				}
			}

			if (stderrPath != null) {
				try {
					this.stderr = new PrintStream(Files.newOutputStream(stderrPath), true);
				}
				catch (IOException ex) {
					throw new JUnitException("Error redirecting stderr to file: " + stderrPath, ex);
				}
			}
		}

		if (this.stdout != null) {
			System.setOut(this.stdout);
		}
		if (this.stderr != null) {
			System.setErr(this.stderr);

View on GitHub (pinned to 956246301e)

When it happens

Trigger: Thrown at junit-platform-console/src/main/java/org/junit/platform/console/command/StandardStreamsHandler.java:60 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of junit-team/junit5@956246301e (2026-08-04). Data as JSON: /data/errors/efd30a46d890e387.json. Report an issue: GitHub.