Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix issue in spawn where args are not properly attached #89

Closed
wants to merge 3 commits into from

2 participants

@johnmdonahue

When running jake lint (RE: #87), I was getting an enormous output and realized that it was a result of the spawned process not using the --config flag, and merging in my default jshintrc opts. I tried to add the --config flag in several ways using spawn but failed:

https://gist.github.com/1998016

What ended up working was using exec. I am not sure what actually causes this and unfortunately I don't really have the time to look into it now but this fix seems to work. Also I am not sure if or where a test would need to be implemented for this fix. So let me know if I need to do anything there.

Thanks.

@brentlintner
Collaborator

Ah! With spawn's second arg, every space in the CLI command is another item in the Array.

Example: (line 6 of the first file in the gist link you posted)

cmd = spawn("jshint", args.concat(["--config", ".jshintrc", "--show-non-errors"]));

I believe that should work!

@johnmdonahue

Indeed! Thanks. This is now fixed if you're ok with the diff. That said and as mentioned elsewhere, this solution would render this fix unnecessary but if you'd like to pull this in for this version, please feel free.

Thanks.

@johnmdonahue

Closing this in lieu of solution proposed in #88

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 1 deletion.
  1. +2 −1  build/lint.js
View
3  build/lint.js
@@ -1,7 +1,7 @@
module.exports = function (files) {
var args = files && files.length > 0 ? files : ["."],
spawn = require('child_process').spawn,
- cmd = spawn("jshint", args.concat(["--show-non-errors"]));
+ cmd = spawn("jshint", args.concat(["--config", ".jshintrc", "--show-non-errors"]));
function write(data) {
process.stdout.write(new Buffer(data).toString("utf-8"));
@@ -9,4 +9,5 @@ module.exports = function (files) {
cmd.stdout.on('data', write);
cmd.stderr.on('data', write);
+
};
Something went wrong with that request. Please try again.