I'm using this in a project and we have an option to start our server with a flag that turns a feature on.
i.e.
node server.js -onflag
The gulp-express based task is one of many files run as part of a larger 'gulp serve' task.
The intended behavior was for
gulp serve -onflag
to lead to a 'node server.js -onflag' child process spawned from gulp-express.
Looking at lines 66 through 70 of the code
} else {
args = options.args;
args.push(options.file);
}
lead to the node process getting passed this array ['-onflag', options.file]
This was causing an invalid flag error from the node process. If you type node --help at the terminal,
You get this.
Usage: node [options] [ -e script | script.js ] [arguments].
Basically, the code as written sends options rather than arguments. I switched the args.push for
[options.file].concat(args) and it works great now.
Hello,
I'm using this in a project and we have an option to start our server with a flag that turns a feature on. i.e.
node server.js -onflag
The gulp-express based task is one of many files run as part of a larger 'gulp serve' task. The intended behavior was for
gulp serve -onflag
to lead to a 'node server.js -onflag' child process spawned from gulp-express. Looking at lines 66 through 70 of the code } else { args = options.args; args.push(options.file); } lead to the node process getting passed this array ['-onflag', options.file]
This was causing an invalid flag error from the node process. If you type node --help at the terminal, You get this. Usage: node [options] [ -e script | script.js ] [arguments].
Basically, the code as written sends options rather than arguments. I switched the args.push for [options.file].concat(args) and it works great now.
Submitting a pull request also.