Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
npm-exec(1) -- Add local package binaries to path and execute command | ||
==================================== | ||
|
||
## SYNOPSIS | ||
|
||
npm exec | ||
|
||
## DESCRIPTION | ||
|
||
Adds the local package bin path (eg. node_modules/.bin) before executing the | ||
command. | ||
|
||
## SEE ALSO | ||
|
||
* npm-bin(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module.exports = exec | ||
|
||
var npm = require("./npm.js") | ||
, output = require("./utils/output.js") | ||
|
||
exec.usage = "npm exec\n(add local package binaries to path and execute command)" | ||
|
||
function exec (args, cb) { | ||
var path = require("path") | ||
, b = npm.bin | ||
, PATH = (process.env.PATH || "").split(":") | ||
, exec = require("child_process").exec | ||
|
||
var cmd = "PATH=" + b + ":$PATH " + args.join(" ") | ||
exec(cmd, function (error, stdout, stderr) { | ||
output.write(stdout, function (er) { cb(er, stdout) }) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters