This is an automated email from the ASF dual-hosted git repository.
olamy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
The following commit(s) were added to refs/heads/master by this push:
new 238061eaa Fix #3366: list only file names in CommandlineExecutorTest
on Windows (#3607)
238061eaa is described below
commit 238061eaa36bd18bc4b79ed451171541e6c6b9f9
Author: Olivier Lamy <[email protected]>
AuthorDate: Sat Nov 21 17:46:04 2026 +1000
Fix #3366: list only file names in CommandlineExecutorTest on Windows
(#3607)
Plain dir prints a localized header ("Datenträger ..." on German Windows)
that doesn't decode as UTF-8, the default charset since JDK 18. The line
reader stopped at the first bad byte, so a.txt was never seen.
---
.../maven/plugin/surefire/extensions/CommandlineExecutorTest.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git
a/surefire-extensions-api/src/test/java/org/apache/maven/plugin/surefire/extensions/CommandlineExecutorTest.java
b/surefire-extensions-api/src/test/java/org/apache/maven/plugin/surefire/extensions/CommandlineExecutorTest.java
index 185215fc5..da56b2707 100644
---
a/surefire-extensions-api/src/test/java/org/apache/maven/plugin/surefire/extensions/CommandlineExecutorTest.java
+++
b/surefire-extensions-api/src/test/java/org/apache/maven/plugin/surefire/extensions/CommandlineExecutorTest.java
@@ -78,7 +78,9 @@ void tearDown() throws Exception {
@Test
void shouldExecuteNativeCommand() throws Exception {
Closeable closer = mock(Closeable.class);
- Commandline cli = new Commandline(IS_OS_WINDOWS ? "cmd.exe /c dir" :
"ls -la");
+ // "dir /b" prints only the file names. Plain "dir" adds a localized
header
+ // that can fail to decode with the default charset, see #3366.
+ Commandline cli = new Commandline(IS_OS_WINDOWS ? "cmd.exe /c dir /b"
: "ls -la");
cli.setWorkingDirectory(
Paths.get(baseDir, "target",
"CommandlineExecutorTest").toFile());
CountdownCloseable countdownCloseable = new CountdownCloseable(closer,
1);