From 283d05d7bcec853a566a96deed2ac799c0aa3961 Mon Sep 17 00:00:00 2001 From: Milton Howe Date: Thu, 28 May 2015 12:23:41 -0400 Subject: [PATCH] Change command-line arg to stdin to fix Win32 bug for command lines > 8k --- index.js | 17 +++++++++-------- lib/background.js | 9 +++++++-- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/index.js b/index.js index 567c1d1..d461931 100644 --- a/index.js +++ b/index.js @@ -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) { diff --git a/lib/background.js b/lib/background.js index 00db7d7..ea0cd47 100644 --- a/lib/background.js +++ b/lib/background.js @@ -1,3 +1,8 @@ var server = require('karma').server; -var data = JSON.parse(process.argv[2]); -server.start(data); \ No newline at end of file +process.stdin.on('readable', function () { + var list = process.stdin.read(); + if (list) { + var data = JSON.parse(list); + server.start(data); + } +});