Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2011-10-03 07:30:40 +0400
committerisaacs <i@izs.me>2011-10-03 07:30:40 +0400
commite9a3079ea34586c56ca0eb3fabda527a88c8a48f (patch)
treea73067ea5e1bd850b9ded7be6906c56fd29a8f10 /lib
parentac51a713d10a02ba71c3070bce2e13a550b6aa80 (diff)
Close #1120 Don't pass -o for windows or non-root users
Diffstat (limited to 'lib')
-rw-r--r--lib/utils/tar.js7
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) {