summaryrefslogtreecommitdiff
path: root/deps/npm/lib/run-script.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/lib/run-script.js')
-rw-r--r--deps/npm/lib/run-script.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/deps/npm/lib/run-script.js b/deps/npm/lib/run-script.js
index fd26a0c43b..ce8ea0f13a 100644
--- a/deps/npm/lib/run-script.js
+++ b/deps/npm/lib/run-script.js
@@ -125,9 +125,17 @@ function run (pkg, wd, cmd, args, cb) {
} else {
if (!pkg.scripts[cmd]) {
if (cmd === "test") {
- pkg.scripts.test = "echo \"Error: no test specified\"";
+ pkg.scripts.test = "echo \"Error: no test specified\""
+ } else if (cmd === "env") {
+ if (process.platform === "win32") {
+ log.verbose("run-script using default platform env: SET (Windows)")
+ pkg.scripts[cmd] = "SET"
+ } else {
+ log.verbose("run-script using default platform env: env (Unix)")
+ pkg.scripts[cmd] = "env"
+ }
} else {
- return cb(new Error("missing script: " + cmd));
+ return cb(new Error("missing script: " + cmd))
}
}
cmds = [cmd]
@@ -140,7 +148,9 @@ function run (pkg, wd, cmd, args, cb) {
log.verbose("run-script", cmds)
chain(cmds.map(function (c) {
// pass cli arguments after -- to script.
- if (pkg.scripts[c] && c === cmd) pkg.scripts[c] = pkg.scripts[c] + joinArgs(args)
+ if (pkg.scripts[c] && c === cmd) {
+ pkg.scripts[c] = pkg.scripts[c] + joinArgs(args)
+ }
// when running scripts explicitly, assume that they're trusted.
return [lifecycle, pkg, c, wd, true]