Skip to content

Commit e793947

Browse files
committed
test symlink to /dev/stdin
1 parent b260061 commit e793947

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/parallel/test-linux-dev-stdin.js

+9
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ if (!common.isLinux) {
1212

1313
const child_process = require('child_process');
1414
const assert = require('assert');
15+
const fs = require('fs');
1516

1617
const cp = child_process.execSync(`printf 'console.log(1)' | "${process.execPath}" /dev/stdin`, { stdio: 'pipe' });
1718
assert.strictEqual(cp.toString(), '1\n');
19+
20+
if (fs.existsSync('/tmp/stdin')) {
21+
fs.unlinkSync('/tmp/stdin');
22+
}
23+
fs.symlinkSync('/dev/stdin', '/tmp/stdin');
24+
const cp2 = child_process.execSync(`printf 'console.log(2)' | "${process.execPath}" /tmp/stdin`, { stdio: 'pipe' });
25+
assert.strictEqual(cp2.toString(), '2\n');
26+
fs.unlinkSync('/tmp/stdin');

0 commit comments

Comments
 (0)