Skip to content

Commit 93b240f

Browse files
committed
Handle BSD tar output lines on stderr correctly
1 parent 0065f58 commit 93b240f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/java/org/scijava/launcher/Archives.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,13 @@ public static Future<Void> untar(File file, File destDir, Consumer<String> outpu
120120

121121
Thread stderrThread = new Thread(() -> {
122122
try (BufferedReader reader = new BufferedReader(new InputStreamReader(p.getErrorStream()))) {
123-
readLines(reader, shouldStop, line -> errorOutput.append(line).append(NL));
123+
readLines(reader, shouldStop, line -> {
124+
if (line.matches("^x .*")) {
125+
// BSD tar output style - strip prefix and forward.
126+
if (outputConsumer != null) outputConsumer.accept(line.replaceFirst("^x ", ""));
127+
}
128+
else errorOutput.append(line).append(NL); // Record actual error.
129+
});
124130
}
125131
catch (IOException e) {
126132
appendException(errorOutput, e);

0 commit comments

Comments
 (0)