1
0
Fork 0

try ignore eperm

pull/1344/head
Cory Miller 2023-02-17 20:37:22 +00:00
parent 6a357de342
commit 6a3c62d3a8
2 changed files with 4 additions and 8 deletions

View File

@ -193,7 +193,6 @@ describe('cp', () => {
describe('mv', () => { describe('mv', () => {
beforeAll(async () => { beforeAll(async () => {
console.log('before')
await io.rmRF(getTestTemp()) await io.rmRF(getTestTemp())
}) })
@ -201,13 +200,9 @@ describe('mv', () => {
const root = path.join(getTestTemp(), ' mv_with_no_flags') const root = path.join(getTestTemp(), ' mv_with_no_flags')
const sourceFile = path.join(root, ' mv_source') const sourceFile = path.join(root, ' mv_source')
const targetFile = path.join(root, ' mv_target') const targetFile = path.join(root, ' mv_target')
console.log('make')
await io.mkdirP(root) await io.mkdirP(root)
console.log('write')
await fs.writeFile(sourceFile, 'test file content', {encoding: 'utf8'}) await fs.writeFile(sourceFile, 'test file content', {encoding: 'utf8'})
console.log('move')
await io.mv(sourceFile, targetFile) await io.mv(sourceFile, targetFile)
console.log('read')
expect(await fs.readFile(targetFile, {encoding: 'utf8'})).toBe( expect(await fs.readFile(targetFile, {encoding: 'utf8'})).toBe(
'test file content' 'test file content'
) )

View File

@ -125,7 +125,7 @@ export async function rmRF(inputPath: string): Promise<void> {
'File path must not contain `*`, `"`, `<`, `>` or `|` on Windows' 'File path must not contain `*`, `"`, `<`, `>` or `|` on Windows'
) )
} }
console.log('a')
try { try {
const cmdPath = ioUtil.getCmdPath() const cmdPath = ioUtil.getCmdPath()
@ -163,16 +163,17 @@ export async function rmRF(inputPath: string): Promise<void> {
// other errors are valid // other errors are valid
if (err.code !== 'ENOENT') throw err if (err.code !== 'ENOENT') throw err
} }
console.log('b')
// Shelling out fails to remove a symlink folder with missing source, this unlink catches that // Shelling out fails to remove a symlink folder with missing source, this unlink catches that
try { try {
if (await ioUtil.exists(inputPath)) { if (await ioUtil.exists(inputPath)) {
console.log('exists')
await ioUtil.unlink(inputPath) await ioUtil.unlink(inputPath)
} }
} catch (err) { } catch (err) {
// if you try to delete a file that doesn't exist, desired result is achieved // if you try to delete a file that doesn't exist, desired result is achieved
// other errors are valid // other errors are valid
if (err.code !== 'ENOENT') throw err if (err.code !== 'ENOENT' || err.code !== 'EPERM') throw err
} }
} else { } else {
let isDir = false let isDir = false