diff --git a/src/BinDeps.jl b/src/BinDeps.jl index 7a63649..7334e0c 100644 --- a/src/BinDeps.jl +++ b/src/BinDeps.jl @@ -113,12 +113,13 @@ if Compat.Sys.iswindows() const exe7z = joinpath(JULIA_HOME, "7z.exe") function unpack_cmd(file,directory,extension,secondary_extension) - if ((extension == ".Z" || extension == ".gz" || extension == ".xz" || extension == ".bz2") && - secondary_extension == ".tar") || extension == ".tgz" || extension == ".tbz" - return pipeline(`$exe7z x $file -y -so`, `$exe7z x -si -y -ttar -o$directory`) - elseif (extension == ".zip" || extension == ".7z" || extension == ".tar" || - (extension == ".exe" && secondary_extension == ".7z")) - return (`$exe7z x $file -y -o$directory`) + if (extension in [".Z", ".gz", ".xz", ".bz2"] && secondary_extension == ".tar") || + extension == ".tgz" || extension == ".tbz" + return pipeline(Cmd([exe7z, "x", file, "-y", "-so"]), + Cmd([exe7z, "x", "-si", "-y", "-ttar", "-o" * directory])) + elseif extension in [".zip", ".7z", ".tar"] || + (extension == ".exe" && secondary_extension == ".7z") + return Cmd([exe7z, "x", file, "-y", "-o" * directory]) end error("I don't know how to unpack $file") end diff --git a/test/runtests.jl b/test/runtests.jl index a8fb0b4..f43ac37 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -33,3 +33,10 @@ let gv = glibc_version() @test gv === nothing end end + +if Compat.Sys.iswindows() + file = "C:\\junk.zip" + dir = "D:\\junk" + @test BinDeps.unpack_cmd(file, dir, ".zip", "") == + `$(joinpath(JULIA_HOME, "7z.exe")) -x $file -y -o $dir` +end