Skip to content

Commit

Permalink
fixing windows spawn bug
Browse files Browse the repository at this point in the history
  • Loading branch information
zetlen committed Nov 22, 2014
1 parent cfc5857 commit 7707e9e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion fenestrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ var fs = require('fs'),
cmdArgs = process.argv.slice(2),
cmd = cmdArgs.shift(),
modulePath = cmdArgs.shift(),
windows = /^win/.test(process.platform),
helpText = fs.readFileSync(path.resolve(__dirname, './README.md'), 'utf-8').split('<!-- cut here -->').shift(),
dependencyTypes = ["dependencies","devDependencies"];

Expand Down Expand Up @@ -78,10 +79,15 @@ function flattenDependencies(declared, resolved, depType) {

function reinstallNodeModules(p, prod, cb) {
rimraf(path.resolve(p, "./node_modules"), function(err) {

var cmd = prod ? "npm install --production" : "npm install",
args = ((windows ? "cmd /c " : "") + cmd).split(' ');

if (err) {
cb(err);
} else {
childProcess.spawn('npm', prod ? ['install','--production'] : ['install'], { cwd: p, stdio: 'inherit' }).on('close', function(code) {

childProcess.spawn(args[0], args.slice(1), { cwd: p, stdio: 'inherit' }).on('close', function(code) {
cb(null, code);
});
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"title": "fenestrate",
"author": "James Zetlen",
"description": "Flatten the dependency tree of an NPM module so it can fit into the Windows 260-character path limitation.",
"version": "0.1.1",
"version": "0.2.0",
"bin": {
"fenestrate": "./bin/fenestrate"
},
Expand All @@ -12,6 +12,7 @@
"url": "https://github.com/zetlen/fenestrate.git"
},
"dependencies": {
"minimist": "^1.1.0",
"rimraf": "^2.2.8"
},
"main": "./fenestrate",
Expand Down

0 comments on commit 7707e9e

Please sign in to comment.