0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00
nodejs/test/parallel/test-fs-realpath-pipe.js
Richard Lau 035e06317a test: disambiguate AIX and IBM i
When built with Python 3.9 on IBM i, `process.platform` will return
`os400` instead of `aix`. In preparation for this, make `common.isAIX`
only return true for AIX and update the tests to add checks for
`common.isIBMi` where they were missing.

PR-URL: https://github.com/nodejs/node/pull/48056
Refs: https://github.com/nodejs/node/pull/46739
Refs: https://github.com/nodejs/build/pull/3358
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2023-09-29 18:26:27 +00:00

40 lines
848 B
JavaScript

'use strict';
const common = require('../common');
if (common.isWindows || common.isAIX || common.isIBMi)
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) {
console.error(err);
process.exit(1);
}
if (resolvedPath) {
process.exit(2);
}
});`,
`try {
if (require('fs').realpathSync('/dev/stdin')) {
process.exit(2);
}
} catch (e) {
console.error(e);
process.exit(1);
}`,
]) {
const child = spawnSync(process.execPath, ['-e', code], {
stdio: 'pipe'
});
if (child.status !== 2) {
console.log(code);
console.log(child.stderr.toString());
}
assert.strictEqual(child.status, 2);
}