mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
99e0d0d218
PR-URL: https://github.com/nodejs/node/pull/55125 Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
24 lines
743 B
JavaScript
24 lines
743 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const fixtures = require('../common/fixtures');
|
|
const tmpdir = require('../common/tmpdir');
|
|
const assert = require('assert');
|
|
const childProcess = require('child_process');
|
|
const fs = require('fs');
|
|
|
|
const stdoutScript = fixtures.path('echo-close-check.js');
|
|
const tmpFile = tmpdir.resolve('stdin.txt');
|
|
const string = fixtures.utf8TestText;
|
|
|
|
tmpdir.refresh();
|
|
|
|
fs.writeFileSync(tmpFile, string);
|
|
|
|
childProcess.exec(...common.escapePOSIXShell`"${process.argv0}" "${stdoutScript}" < "${tmpFile}"`, common.mustCall(function(err, stdout, stderr) {
|
|
fs.unlinkSync(tmpFile);
|
|
|
|
assert.ifError(err);
|
|
assert.strictEqual(stdout, `hello world\r\n${string}`);
|
|
assert.strictEqual(stderr, '');
|
|
}));
|