mirror of https://github.com/lukechilds/node.git
Browse Source
PR-URL: https://github.com/nodejs/node/pull/13012 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>v6
committed by
Anna Henningsen
7 changed files with 71 additions and 29 deletions
@ -0,0 +1,17 @@ |
|||||
|
'use strict'; |
||||
|
const common = require('../common'); |
||||
|
const assert = require('assert'); |
||||
|
|
||||
|
const expected = '--option-to-be-seen-on-child'; |
||||
|
|
||||
|
const { spawn } = require('child_process'); |
||||
|
const child = spawn(process.execPath, ['-', expected], { stdio: 'pipe' }); |
||||
|
|
||||
|
child.stdin.end('console.log(process.argv[2])'); |
||||
|
|
||||
|
let actual = ''; |
||||
|
child.stdout.setEncoding('utf8'); |
||||
|
child.stdout.on('data', (chunk) => actual += chunk); |
||||
|
child.stdout.on('end', common.mustCall(() => { |
||||
|
assert.strictEqual(actual.trim(), expected); |
||||
|
})); |
Loading…
Reference in new issue