commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject [commons-compress] branch master updated: OK, so tar fails. Try to figure out why.
Date Sat, 25 Jan 2020 14:02:55 GMT
This is an automated email from the ASF dual-hosted git repository.

bodewig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git


The following commit(s) were added to refs/heads/master by this push:
     new 57464b2  OK, so tar fails. Try to figure out why.
57464b2 is described below

commit 57464b2f19e0cb048d549fc6f7682ce324bcf9ad
Author: Stefan Bodewig <bodewig@apache.org>
AuthorDate: Sat Jan 25 15:02:33 2020 +0100

    OK, so tar fails. Try to figure out why.
---
 .../org/apache/commons/compress/archivers/tar/SparseFilesTest.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/SparseFilesTest.java
b/src/test/java/org/apache/commons/compress/archivers/tar/SparseFilesTest.java
index 028de5f..8aa8adf 100644
--- a/src/test/java/org/apache/commons/compress/archivers/tar/SparseFilesTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/tar/SparseFilesTest.java
@@ -233,10 +233,11 @@ public class SparseFilesTest extends AbstractTestCase {
     }
 
     private InputStream extractTarAndGetInputStream(File tarFile, String sparseFileName)
throws IOException, InterruptedException {
-        Runtime runtime = Runtime.getRuntime();
-        Process process = runtime.exec("tar -xf " + tarFile.getPath() + " -C " + resultDir.getPath());
+        ProcessBuilder pb = new ProcessBuilder("tar", "-xf", tarFile.getPath(), "-C", resultDir.getPath());
+        pb.redirectErrorStream(true);
+        Process process = pb.start();
         // wait until the extract finishes
-        assertEquals(0, process.waitFor());
+        assertEquals(new String(IOUtils.toByteArray(process.getInputStream())), 0, process.waitFor());
 
         for (File file : resultDir.listFiles()) {
             if (file.getName().equals(sparseFileName)) {


Mime
View raw message