diff options
author | isaacs <i@izs.me> | 2011-10-03 07:30:40 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2011-10-03 07:30:40 +0400 |
commit | e9a3079ea34586c56ca0eb3fabda527a88c8a48f (patch) | |
tree | a73067ea5e1bd850b9ded7be6906c56fd29a8f10 /lib | |
parent | ac51a713d10a02ba71c3070bce2e13a550b6aa80 (diff) |
Close #1120 Don't pass -o for windows or non-root users
Diffstat (limited to 'lib')
-rw-r--r-- | lib/utils/tar.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/utils/tar.js b/lib/utils/tar.js index f26818e22..651d8fd3d 100644 --- a/lib/utils/tar.js +++ b/lib/utils/tar.js @@ -162,9 +162,14 @@ function gunzTarPerm (tarball, tmp, dMode, fMode, uid, gid, cb) { // HACK tar on windows prefers forward slashes (or double backslashes) var tmpTar = process.platform === "win32" ? tmp.replace(/\\/g, "/") : tmp + , tarArgs = ["-zmvxpf", tarball, "-C", tmpTar] + + if (process.platform !== "win32" || 0 === process.getuid()) { + tarArgs.push(["-o"]) + } var tar = spawn( npm.config.get("tar") - , ["-zmvxpf", tarball, "-o", "-C", tmpTar] + , tarArgs , process.env, false ) tar.on("exit", function (code) { |