test('do not use SonicBoom is someone tampered with process.stdout.write', async ({ isNot }) => { var actual = '' const child = fork(join(__dirname, 'fixtures', 'stdout-hack-protection.js'), { silent: true }) child.stdout.pipe(writer((s, enc, cb) => { actual += s cb() })) await once(child, 'close') isNot(actual.match(/^hack/), null) })
function test (file) { file = join('fixtures', 'broken-pipe', file) t.test(file, { parallel: true }, async ({ is }) => { const child = fork(join(__dirname, file), { silent: true }) child.stdout.destroy() child.stderr.pipe(process.stdout) const res = await once(child, 'close') is(res, 0) // process exits successfully }) }
child.stdout.on("data", (data) => { dashboard.onEvent({ type: "stdout", data: data.toString("utf8") }); });
function runYarn(cwd, args, resolveOutput) { const isWin = os.platform() === "win32"; return new Promise((resolve, reject) => { debug("yarn", yarnPath, args, cwd); var child = fork(yarnPath, args || [], { cwd: cwd, stdio: !resolveOutput ? "inherit" : "pipe" }); if (isWin) { // a windows bug. need to press enter sometimes try { // process.stdin.write("\n"); // process.stdin.end(); } catch (e) {} } var output = ""; if (resolveOutput) { child.stdout.on("data", data => { output += data; }); } child.on("exit", code => { debug("yarn completed"); resolve(output); }); }); }
this.dashboardAppProcess.stdout.on('data', (data) => { console.log(data.toString()); if (data.toString().match(/Compiled/)) {
this._frontend.terminalData('stderr', data.toString('base64')); }); p.stdout.on('data', data => { if (process.connected) this._frontend.terminalData('stdout', data.toString('base64'));
child.stdout.pipe(writer((s, enc, cb) => { actual2 += s cb()
child.stdout.pipe(writer((s, enc, cb) => { actual2 += s cb()
_startInstance(local) { winston.debug('[ProviderLocal] _startInstance: local=', local); return new Promise((resolve) => { const child = child_process.exec(`node ./e2e/providers/local/proxy/index.js ${local.name} ${local.port}`); child.stdout.on( 'data', (data) => winston.debug('[ProviderLocal/%s] (stdout) %s', local.name, data) ); child.stderr.on( 'data', (data) => winston.debug('[ProviderLocal/%s] (stderr) %s', local.name, data) ); child.on( 'close', () => winston.debug('[ProviderLocal/%s] Close', local.name) ); local.child = child; resolve(local); }); }
start() { winston.debug('[TestServer] start'); return new Promise((resolve) => { const child = child_process.exec('node ./e2e/test-server/server/index.js 13337'); child.stdout.on( 'data', (data) => winston.debug('[TestServer] (stdout) %s', data) ); child.stderr.on( 'data', (data) => winston.debug('[TestServer] (stderr) %s', data) ); child.on( 'close', () => winston.debug('[TestServer] Close') ); this._child = child; resolve(child); }); }
]); const childProcess = promise.childProcess; childProcess.stdout.on('data', data => {
const run = function(opts: ISumanOpts){ const script = path.resolve(__dirname + '/../../scripts/suman-postinstall.sh'); console.log('\n'); console.log(' => Suman will run its postinstall routine.'); console.log('\n'); const k = cp.spawn(script); k.stdout.pipe(process.stdout); k.stderr.pipe(process.stderr); k.once('close', function (code: number) { process.exit(code || 0); }); }
function echoServer (type, cb) { if (typeof type === 'function') return echoServer('http', type) var script = path.join(__dirname, '_echo_server.js') var cp = exec(`node "${script}" ${type}`) cp.stderr.pipe(process.stderr) cp.stdout.once('data', function (chunk) { var port = chunk.trim().split('\n')[0] cb(cp, port) }) }
function runYarn(cwd, args, resolveOutput) { const isWin = os.platform() === "win32"; return new Promise((resolve, reject) => { debug("yarn", yarnPath, args, cwd); var child = fork(yarnPath, args || [], { cwd: cwd, stdio: !resolveOutput ? "inherit" : "pipe" }); if (isWin) { // a windows bug. need to press enter sometimes try { // process.stdin.write("\n"); // process.stdin.end(); } catch (e) {} } var output = ""; if (resolveOutput) { child.stdout.on("data", data => { output += data; }); } child.on("exit", code => { debug("yarn completed"); resolve(output); }); }); }