From d0f677afa176ffb7439897fe02b57a38222978f9 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 26 Mar 2016 19:33:48 -0700 Subject: [PATCH 1/3] test: add known_issues test for GH-2148 Refs: https://github.com/nodejs/node/issues/2148 --- .../test-stdout-buffer-flush-on-exit.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/known_issues/test-stdout-buffer-flush-on-exit.js diff --git a/test/known_issues/test-stdout-buffer-flush-on-exit.js b/test/known_issues/test-stdout-buffer-flush-on-exit.js new file mode 100644 index 00000000000000..42d9e723f0946f --- /dev/null +++ b/test/known_issues/test-stdout-buffer-flush-on-exit.js @@ -0,0 +1,19 @@ +'use strict'; +// Refs: https://github.com/nodejs/node/issues/2148 +require('../common'); +const assert = require('assert'); +const execSync = require('child_process').execSync; + +const longLine = 'foo bar baz quux quuz aaa bbb ccc'.repeat(80); +const expectedLength = (longLine.length * 999) + 1; + +if (process.argv[2] === 'child') { + process.on('exit', () => { + console.log(longLine.repeat(999)); + }); + process.exit(); +} + +const stdout = execSync(`${process.execPath} ${__filename} child`); + +assert.strictEqual(stdout.length, expectedLength); From b12cf06d0aa3807ad5f93261fa5c17ef7c54ca29 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 28 Mar 2016 14:09:53 -0700 Subject: [PATCH 2/3] fixup per mscdex --- .../known_issues/test-stdout-buffer-flush-on-exit.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/known_issues/test-stdout-buffer-flush-on-exit.js b/test/known_issues/test-stdout-buffer-flush-on-exit.js index 42d9e723f0946f..45bbc98f98eded 100644 --- a/test/known_issues/test-stdout-buffer-flush-on-exit.js +++ b/test/known_issues/test-stdout-buffer-flush-on-exit.js @@ -1,19 +1,21 @@ 'use strict'; // Refs: https://github.com/nodejs/node/issues/2148 + require('../common'); const assert = require('assert'); const execSync = require('child_process').execSync; -const longLine = 'foo bar baz quux quuz aaa bbb ccc'.repeat(80); -const expectedLength = (longLine.length * 999) + 1; +const longLine = 'foo bar baz quux quuz aaa bbb ccc'.repeat(65536); if (process.argv[2] === 'child') { process.on('exit', () => { - console.log(longLine.repeat(999)); + console.log(longLine); }); process.exit(); } -const stdout = execSync(`${process.execPath} ${__filename} child`); +const stdout = execSync(`${process.execPath} ${__filename} child`) + .toString() + .trim(); -assert.strictEqual(stdout.length, expectedLength); +assert.strictEqual(stdout, longLine); From cfb494ea3d7cb79c5fb3c56f47f95601ad406917 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 28 Mar 2016 16:02:59 -0700 Subject: [PATCH 3/3] fixup: nit per mscdex/fishrock123 --- test/known_issues/test-stdout-buffer-flush-on-exit.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/known_issues/test-stdout-buffer-flush-on-exit.js b/test/known_issues/test-stdout-buffer-flush-on-exit.js index 45bbc98f98eded..f4ea0b5e01b2e1 100644 --- a/test/known_issues/test-stdout-buffer-flush-on-exit.js +++ b/test/known_issues/test-stdout-buffer-flush-on-exit.js @@ -14,8 +14,7 @@ if (process.argv[2] === 'child') { process.exit(); } -const stdout = execSync(`${process.execPath} ${__filename} child`) - .toString() - .trim(); +const cmd = `${process.execPath} ${__filename} child`; +const stdout = execSync(cmd).toString().trim(); assert.strictEqual(stdout, longLine);