summaryrefslogtreecommitdiff
path: root/test/parallel/test-fs-realpath-pipe.js
diff options
context:
space:
mode:
authorEbrahim Byagowi <ebrahim@gnu.org>2017-05-15 03:27:54 +0430
committerRefael Ackermann <refack@gmail.com>2017-05-25 18:18:29 -0400
commitb3d1e3d4c720729c8f14e413a285660547ee677a (patch)
tree1791f7cd391391d19995458de9a16cee699f90fc /test/parallel/test-fs-realpath-pipe.js
parenta109032260148242fa1f1b911a1a8a142ce95d86 (diff)
downloadandroid-node-v8-b3d1e3d4c720729c8f14e413a285660547ee677a.tar.gz
android-node-v8-b3d1e3d4c720729c8f14e413a285660547ee677a.tar.bz2
android-node-v8-b3d1e3d4c720729c8f14e413a285660547ee677a.zip
fs: fix realpath{Sync} on resolving pipes/sockets
PR-URL: https://github.com/nodejs/node/pull/13028 Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'test/parallel/test-fs-realpath-pipe.js')
-rw-r--r--test/parallel/test-fs-realpath-pipe.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/parallel/test-fs-realpath-pipe.js b/test/parallel/test-fs-realpath-pipe.js
new file mode 100644
index 0000000000..89bdc08229
--- /dev/null
+++ b/test/parallel/test-fs-realpath-pipe.js
@@ -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);
+}