# HG changeset patch # User wenzelm # Date 1285590895 -7200 # Node ID 1fa4c5c7d53412b630ca72e72c9724115d69512d # Parent c3239be617f48dfe5289135cc7a325137d1f23a0 some more options to robustify posix_untar; diff -r c3239be617f4 -r 1fa4c5c7d534 src/Pure/System/standard_system.scala --- a/src/Pure/System/standard_system.scala Mon Sep 27 13:38:35 2010 +0200 +++ b/src/Pure/System/standard_system.scala Mon Sep 27 14:34:55 2010 +0200 @@ -160,7 +160,7 @@ /* unpack tar archive */ def posix_untar(url: URL, root: File, gunzip: Boolean = false, - tar: String = "tar", progress: Int => Unit = _ => ()): String = + tar: String = "tar", gzip: String = "", progress: Int => Unit = _ => ()): String = { if (!root.isDirectory && !root.mkdirs) error("Failed to create root directory: " + root) @@ -189,7 +189,11 @@ override def close() { stream.close } } - val proc = raw_execute(root, null, false, tar, if (gunzip) "-xz" else "-x", "-f-") + val cmdline = + List(tar, "-o", "-x", "-f-") ::: + (if (!gunzip) Nil else if (gzip == "") List("-z") else List("-I", gzip)) + + val proc = raw_execute(root, null, false, cmdline:_*) val stdout = Simple_Thread.future("tar_stdout") { slurp(proc.getInputStream) } val stderr = Simple_Thread.future("tar_stderr") { slurp(proc.getErrorStream) } val stdin = new BufferedOutputStream(proc.getOutputStream)