Skip to content
This repository was archived by the owner on May 24, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,16 @@ var karmaPlugin = function(options) {

// Start the server
child = spawn(
'node',
[
path.join(__dirname, 'lib', 'background.js'),
JSON.stringify(options)
],
{
stdio: 'inherit'
}
'node',
[
path.join(__dirname, 'lib', 'background.js')
],
{
stdio: ['pipe', process.stdout, process.stderr]
}
);
child.stdin.write(JSON.stringify(options));
child.stdin.end();

// Cleanup when the child process exits
child.on('exit', function(code) {
Expand Down
9 changes: 7 additions & 2 deletions lib/background.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
var server = require('karma').server;
var data = JSON.parse(process.argv[2]);
server.start(data);
process.stdin.on('readable', function () {
var list = process.stdin.read();
if (list) {
var data = JSON.parse(list);
server.start(data);
}
});