Closed ghost closed 8 years ago
(I'm a member of Ian's team)
I believe I've tracked this down to a case of dependency hell. We use the grunt-citare-scriptum
module, which is written in CoffeeScript. CoffeeScript itself intercepts child_process.fork
.
It appears that that interceptor doesn't allow the args
parameter to be omitted. It works correctly if an empty array is passed for the args
parameter:
// allow karma to be run in the background so it doesn't block grunt
if (data.background) {
var backgroundProcess = require('child_process').fork(
path.join(__dirname, '..', 'lib', 'background.js'),
[], // must provide 'args' or CoffeeScript's intercepted fork won't pass it to Node
{ silent: true }
)
I don't think that communicating with the background process via stdin
is the best approach. Node.js provides a private communication channel between the parent and child processes, using child.send
. I've implemented this myself and can provide a pull request if you're interested?
@MikeDimmick thanks for the update. Yes I would be very interested in improving this, so would love to see a PR
Environment: Windows 7 x64, Node.js 4.2.3, grunt-karma 0.12.1, karma 0.13.15.
Recently upgraded from Node.js 0.12.x, grunt-karma ^0.10.1, karma ^0.12.31
We have two different grunt tasks - the first that runs karma in a single-run/foreground setup that is used for CI, etc, and the second in a more "watch/live-reload" style setup.
The two tasks have almost identical setups, with the only difference being around the singleRun and background settings, and it is changing the background setting that raises the issue. When background is set to true, the task fails with the following errors:
This appears to be an issue with passing the parameters across stdin to the background process.
A second after the above error there is a second error logged to the console, which seems to be the failure on the other side of this: