node/test/parallel/test-fs-realpath-pipe.js
章礼平 d7a1637897
test: change isAix to isAIX
This makes the naming more consistent with existing properties like
isFreeBSD where the capitalization of the property name is consistent
with the conventional styling of the operating system.

PR-URL: https://github.com/nodejs/node/pull/14263
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Bryan English <bryan@bryanenglish.com>
2017-07-24 18:52:38 +02:00

33 lines
662 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 (e) {
process.exit(1);
}`
]) {
assert.strictEqual(spawnSync(process.execPath, ['-e', code], {
stdio: 'pipe'
}).status, 2);
}