This is an automated email from the ASF dual-hosted git repository. reschke pushed a commit to branch OAK-11630 in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
commit c22dd87581d5f4c3455e0b39dfb93b75f11c6284 Author: Julian Reschke <[email protected]> AuthorDate: Tue Apr 1 06:59:20 2025 +0100 OAK-11630: CommandTestUtils captureSystem* should normalize line feeds --- .../jackrabbit/oak/plugins/document/CommandTestUtils.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/oak-run/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommandTestUtils.java b/oak-run/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommandTestUtils.java index 4cdc28e0d8..f06ce0afd3 100644 --- a/oak-run/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommandTestUtils.java +++ b/oak-run/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommandTestUtils.java @@ -20,9 +20,13 @@ package org.apache.jackrabbit.oak.plugins.document; import java.io.ByteArrayOutputStream; import java.io.PrintStream; +import java.nio.charset.StandardCharsets; public class CommandTestUtils { + /** + * Runs the {@linkplain Runnable}, captures stdout, returns output with line ends normalized to "\" + */ public static String captureSystemOut(Runnable r) { PrintStream old = System.out; try { @@ -31,12 +35,16 @@ public class CommandTestUtils { System.setOut(ps); r.run(); System.out.flush(); - return baos.toString(); + return baos.toString(StandardCharsets.UTF_8). + replace(System.lineSeparator(), "\n"); } finally { System.setOut(old); } } + /** + * Runs the {@linkplain Runnable}, captures stderr, returns output with line ends normalized to "\" + */ public static String captureSystemErr(Runnable r) { PrintStream old = System.err; try { @@ -45,7 +53,8 @@ public class CommandTestUtils { System.setErr(ps); r.run(); System.err.flush(); - return baos.toString(); + return baos.toString(StandardCharsets.UTF_8). + replace(System.lineSeparator(), "\n"); } finally { System.setErr(old); }
