0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-fs-realpath-pipe.js
cjihrig a74b4a062f
test: remove unused catch bindings
PR-URL: https://github.com/nodejs/node/pull/24079
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Wyatt Preul <wpreul@gmail.com>
2018-11-06 10:59:18 -05:00

33 lines
658 B
JavaScript

'use strict';
const common = require('../common');
if (common.isWindows || common.isAIX)
common.skip(`No /dev/stdin on ${process.platform}.`);
const assert = require('assert');
const { spawnSync } = require('child_process');
for (const code of [
`require('fs').realpath('/dev/stdin', (err, resolvedPath) => {
if (err) {
process.exit(1);
}
if (resolvedPath) {
process.exit(2);
}
});`,
`try {
if (require('fs').realpathSync('/dev/stdin')) {
process.exit(2);
}
} catch {
process.exit(1);
}`
]) {
assert.strictEqual(spawnSync(process.execPath, ['-e', code], {
stdio: 'pipe'
}).status, 2);
}