| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,6 +12,7 @@ const { | |||
| 12 | 12 | } = primordials; | |
| 13 | 13 | ||
| 14 | 14 | const { Buffer } = require('buffer'); | |
| 15 | + const fs = require('fs'); | ||
| 15 | 16 | const { | |
| 16 | 17 | chmod, | |
| 17 | 18 | chmodSync, | |
@@ -25,7 +26,7 @@ const { | |||
| 25 | 26 | statSync, | |
| 26 | 27 | unlink, | |
| 27 | 28 | unlinkSync | |
| 28 | - } = require('fs'); | ||
| 29 | + } = fs; | ||
| 29 | 30 | const { sep } = require('path'); | |
| 30 | 31 | const { setTimeout } = require('timers'); | |
| 31 | 32 | const { sleep } = require('internal/util'); | |
@@ -249,7 +250,7 @@ function _rmdirSync(path, options, originalErr) { | |||
| 249 | 250 | ||
| 250 | 251 | for (let i = 1; i <= tries; i++) { | |
| 251 | 252 | try { | |
| 252 | - return rmdirSync(path, options); | ||
| 253 | + return fs.rmdirSync(path); | ||
| 253 | 254 | } catch (err) { | |
| 254 | 255 | // Only sleep if this is not the last try, and the delay is greater | |
| 255 | 256 | // than zero, and an error was encountered that warrants a retry. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,4 @@ | |||
| 1 | + | ||
| 1 | 2 | prefix known_issues | |
| 2 | 3 | ||
| 3 | 4 | # If a known issue does not apply to a platform, list the test name in the | |
@@ -27,5 +28,3 @@ test-vm-timeout-escape-queuemicrotask: SKIP | |||
| 27 | 28 | # The Raspberry Pis are too slow to run this test. | |
| 28 | 29 | # See https://github.com/nodejs/build/issues/2227#issuecomment-608334574 | |
| 29 | 30 | test-crypto-authenticated-stream: SKIP | |
| 30 | - # The bug being checked is that the test never exits. | ||
| 31 | - test-fs-open-no-close: TIMEOUT | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,14 +4,7 @@ | |||
| 4 | 4 | // Failing to close a file should not keep the event loop open. | |
| 5 | 5 | ||
| 6 | 6 | const common = require('../common'); | |
| 7 | - | ||
| 8 | - // This issue only shows up on Raspberry Pi devices in our CI. When this test is | ||
| 9 | - // moved out of known_issues, this check can be removed, as the test should pass | ||
| 10 | - // on all platforms at that point. | ||
| 11 | 7 | const assert = require('assert'); | |
| 12 | - if (process.arch !== 'arm' || process.config.variables.arm_version > 7) { | ||
| 13 | - assert.fail('This test is for Raspberry Pi devices in CI'); | ||
| 14 | - } | ||
| 15 | 8 | ||
| 16 | 9 | const fs = require('fs'); | |
| 17 | 10 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -211,3 +211,28 @@ function removeAsync(dir) { | |||
| 211 | 211 | message: /^The value of "options\.maxRetries" is out of range\./ | |
| 212 | 212 | }); | |
| 213 | 213 | } | |
| 214 | + | ||
| 215 | + // It should not pass recursive option to rmdirSync, when called from | ||
| 216 | + // rimraf (see: #35566) | ||
| 217 | + { | ||
| 218 | + // Make a non-empty directory: | ||
| 219 | + const original = fs.rmdirSync; | ||
| 220 | + const dir = `${nextDirPath()}/foo/bar`; | ||
| 221 | + fs.mkdirSync(dir, { recursive: true }); | ||
| 222 | + fs.writeFileSync(`${dir}/foo.txt`, 'hello world', 'utf8'); | ||
| 223 | + | ||
| 224 | + // When called the second time from rimraf, the recursive option should | ||
| 225 | + // not be set for rmdirSync: | ||
| 226 | + let callCount = 0; | ||
| 227 | + let rmdirSyncOptionsFromRimraf; | ||
| 228 | + fs.rmdirSync = (path, options) => { | ||
| 229 | + if (callCount > 0) { | ||
| 230 | + rmdirSyncOptionsFromRimraf = { ...options }; | ||
| 231 | + } | ||
| 232 | + callCount++; | ||
| 233 | + return original(path, options); | ||
| 234 | + }; | ||
| 235 | + fs.rmdirSync(dir, { recursive: true }); | ||
| 236 | + fs.rmdirSync = original; | ||
| 237 | + assert.strictEqual(rmdirSyncOptionsFromRimraf.recursive, undefined); | ||
| 238 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments