From f5e0efcc8797b0fb1cfbda21702e215e32d07dd7 Mon Sep 17 00:00:00 2001 From: Masahiro Wakame Date: Thu, 21 Nov 2013 17:32:30 +0900 Subject: [PATCH] Fix latent bug it found by prev commit, avoid unexpected callback happen. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit maxBuffer’s default is 200*1024 byte in Node.js require('child_process').exec but… $ node _infrastructure/tests/typescript/tsc.js --noImplicitAny threejs/three-tests.ts 2>&1 > /dev/null | wc 1963 21628 291809 over 200KB, when exec method called callback function, but it is not completed yet. exitCode === undefined. --- _infrastructure/tests/runner.js | 2 +- _infrastructure/tests/src/exec.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/_infrastructure/tests/runner.js b/_infrastructure/tests/runner.js index dd429bd208..ba42dd21e3 100644 --- a/_infrastructure/tests/runner.js +++ b/_infrastructure/tests/runner.js @@ -59,7 +59,7 @@ var NodeExec = (function () { result.exitCode = null; var cmdLine = filename + ' ' + cmdLineArgs.join(' '); - var process = nodeExec(cmdLine, function (error, stdout, stderr) { + var process = nodeExec(cmdLine, { maxBuffer: 1 * 1024 * 1024 }, function (error, stdout, stderr) { result.stdout = stdout; result.stderr = stderr; result.exitCode = error ? error.code : 0; diff --git a/_infrastructure/tests/src/exec.ts b/_infrastructure/tests/src/exec.ts index f277d39425..5123d4cfc6 100644 --- a/_infrastructure/tests/src/exec.ts +++ b/_infrastructure/tests/src/exec.ts @@ -57,8 +57,8 @@ class NodeExec implements IExec { var result = new ExecResult(); result.exitCode = null; var cmdLine = filename + ' ' + cmdLineArgs.join(' '); - - var process = nodeExec(cmdLine, function (error, stdout, stderr) { + + var process = nodeExec(cmdLine, {maxBuffer: 1 * 1024 * 1024}, function (error, stdout, stderr) { result.stdout = stdout; result.stderr = stderr; result.exitCode = error ? error.code : 0;