mirror of https://github.com/lukechilds/node.git
Browse Source
PR-URL: https://github.com/nodejs/node/pull/13028 Reviewed-By: Refael Ackermann <refack@gmail.com>v6
Ebrahim Byagowi
8 years ago
committed by
Refael Ackermann
3 changed files with 59 additions and 5 deletions
@ -0,0 +1,34 @@ |
|||
'use strict'; |
|||
|
|||
const common = require('../common'); |
|||
|
|||
if (common.isWindows || common.isAix) { |
|||
common.skip(`No /dev/stdin on ${process.platform}.`); |
|||
return; |
|||
} |
|||
|
|||
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); |
|||
} |
Loading…
Reference in new issue