|
1 | 1 | 'use strict'; |
2 | | -var common = require('../common'); |
3 | | -var fs = require('fs'); |
4 | | -var path = require('path'); |
5 | | -var assert = require('assert'); |
6 | | -var os = require('os'); |
| 2 | +const common = require('../common'); |
| 3 | +const fs = require('fs'); |
| 4 | +const path = require('path'); |
| 5 | +const os = require('os'); |
7 | 6 |
|
8 | 7 | // when it fails test again under real OS tmp dir on Linux when it is |
9 | 8 | // readable/writable to avoid failing tests on ecryptfs filesystems: |
10 | 9 | // https://github.com/nodejs/node/issues/2255 |
11 | 10 | // it follows advice in comments to: |
12 | 11 | // https://github.com/nodejs/node/pull/3925 |
| 12 | +// https://github.com/nodejs/node/pull/3929 |
13 | 13 | try { |
14 | 14 | common.refreshTmpDir(); |
15 | 15 | testFsLongPath(common.tmpDir); |
16 | 16 | common.refreshTmpDir(); |
17 | 17 | } catch (e) { |
18 | 18 | if (os.type() == 'Linux') { |
19 | 19 | fs.accessSync(os.tmpdir(), fs.R_OK | fs.W_OK); |
20 | | - var tmpDir = path.join(os.tmpdir(), |
21 | | - 'node-' + process.version + '-test-' + (Math.random() * 1e6 | 0)); |
| 20 | + const tmpDir = path.join(os.tmpdir(), |
| 21 | + `node-${process.version}-test-${1e6 * Math.random() | 0}`); |
22 | 22 | fs.mkdirSync(tmpDir); |
23 | 23 | testFsLongPath(tmpDir); |
24 | 24 | fs.rmdirSync(tmpDir); |
|
30 | 30 | function testFsLongPath(tmpDir) { |
31 | 31 |
|
32 | 32 | // make a path that will be at least 260 chars long. |
33 | | - var fileNameLen = Math.max(260 - tmpDir.length - 1, 1); |
34 | | - var fileName = path.join(tmpDir, new Array(fileNameLen + 1).join('x')); |
35 | | - var fullPath = path.resolve(fileName); |
| 33 | + const fileNameLen = Math.max(260 - tmpDir.length - 1, 1); |
| 34 | + const fileName = path.join(tmpDir, new Array(fileNameLen + 1).join('x')); |
| 35 | + const fullPath = path.resolve(fileName); |
36 | 36 |
|
37 | 37 | console.log({ |
38 | 38 | filenameLength: fileName.length, |
|
0 commit comments