Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test-child-process-spawnsync-maxbuf.js « parallel « test - github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 317c0fe0ba29a760c5e047f5d330e1527c2db748 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
'use strict';
require('../common');
const assert = require('assert');

const spawnSync = require('child_process').spawnSync;

const msgOut = 'this is stdout';

// This is actually not os.EOL?
const msgOutBuf = Buffer.from(msgOut + '\n');

const args = [
  '-e',
  `console.log("${msgOut}");`
];

const options = {
  maxBuffer: 1
};

const ret = spawnSync(process.execPath, args, options);

assert.ok(ret.error, 'maxBuffer should error');
assert.strictEqual(ret.error.errno, 'ENOBUFS');
// We can have buffers larger than maxBuffer because underneath we alloc 64k
// that matches our read sizes
assert.deepEqual(ret.stdout, msgOutBuf);