diff options
| author | Jeremiah Senkpiel <fishrock123@rocketmail.com> | 2016-05-15 12:23:03 -0400 |
|---|---|---|
| committer | Jeremiah Senkpiel <fishrock123@rocketmail.com> | 2016-05-16 14:27:13 -0400 |
| commit | 2f6420ba38ab8ccaab3426c49b36484eafeb8e95 (patch) | |
| tree | 57a4de7bf84f6d43ac066cd2c81fdc981366e09e /test/parallel/test-stdout-buffer-flush-on-exit.js | |
| parent | f4f6c6e8151071d6d866603d0837d851fdf49157 (diff) | |
| download | node-new-process-exit-stdio-flushing.tar.gz | |
process: flush stdout/stderr upon `process.exit()`process-exit-stdio-flushing
Diffstat (limited to 'test/parallel/test-stdout-buffer-flush-on-exit.js')
| -rw-r--r-- | test/parallel/test-stdout-buffer-flush-on-exit.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/parallel/test-stdout-buffer-flush-on-exit.js b/test/parallel/test-stdout-buffer-flush-on-exit.js new file mode 100644 index 0000000000..791a9ccd15 --- /dev/null +++ b/test/parallel/test-stdout-buffer-flush-on-exit.js @@ -0,0 +1,25 @@ +'use strict'; +// Refs: https://github.com/nodejs/node/issues/2148 + +require('../common'); +const assert = require('assert'); +const execSync = require('child_process').execSync; + +const lineSeed = 'foo bar baz quux quuz aaa bbb ccc'; + +if (process.argv[2] === 'child') { + const longLine = lineSeed.repeat(parseInt(process.argv[4], 10)); + process.on('exit', () => { + console.log(longLine); + }); + process.exit(); +} + +[22, 16].forEach((exponent) => { + const bigNum = Math.pow(2, exponent); + const longLine = lineSeed.repeat(bigNum); + const cmd = `${process.execPath} ${__filename} child ${exponent} ${bigNum}`; + const stdout = execSync(cmd).toString().trim(); + + assert.strictEqual(stdout, longLine, `failed with exponent ${exponent}`); +}); |
