2020-03-19 22:38:30 +01:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const common = require('../common');
|
|
|
|
const assert = require('assert');
|
|
|
|
const os = require('os');
|
|
|
|
|
|
|
|
if (process.argv[2] === 'child') {
|
|
|
|
const { pipeline } = require('stream');
|
|
|
|
pipeline(
|
|
|
|
process.stdin,
|
|
|
|
process.stdout,
|
2020-09-06 22:27:07 +02:00
|
|
|
common.mustSucceed()
|
2020-03-19 22:38:30 +01:00
|
|
|
);
|
|
|
|
} else {
|
|
|
|
const cp = require('child_process');
|
2024-09-29 22:44:52 +02:00
|
|
|
cp.exec(...common.escapePOSIXShell`echo hello | "${process.execPath}" "${__filename}" child`, common.mustSucceed((stdout) => {
|
2020-03-19 22:38:30 +01:00
|
|
|
assert.strictEqual(stdout.split(os.EOL).shift().trim(), 'hello');
|
|
|
|
}));
|
|
|
|
}
|