mirror of https://github.com/actions/toolkit
try ignore eperm
parent
6a357de342
commit
6a3c62d3a8
|
@ -193,7 +193,6 @@ describe('cp', () => {
|
|||
|
||||
describe('mv', () => {
|
||||
beforeAll(async () => {
|
||||
console.log('before')
|
||||
await io.rmRF(getTestTemp())
|
||||
})
|
||||
|
||||
|
@ -201,13 +200,9 @@ describe('mv', () => {
|
|||
const root = path.join(getTestTemp(), ' mv_with_no_flags')
|
||||
const sourceFile = path.join(root, ' mv_source')
|
||||
const targetFile = path.join(root, ' mv_target')
|
||||
console.log('make')
|
||||
await io.mkdirP(root)
|
||||
console.log('write')
|
||||
await fs.writeFile(sourceFile, 'test file content', {encoding: 'utf8'})
|
||||
console.log('move')
|
||||
await io.mv(sourceFile, targetFile)
|
||||
console.log('read')
|
||||
expect(await fs.readFile(targetFile, {encoding: 'utf8'})).toBe(
|
||||
'test file content'
|
||||
)
|
||||
|
|
|
@ -125,7 +125,7 @@ export async function rmRF(inputPath: string): Promise<void> {
|
|||
'File path must not contain `*`, `"`, `<`, `>` or `|` on Windows'
|
||||
)
|
||||
}
|
||||
console.log('a')
|
||||
|
||||
try {
|
||||
const cmdPath = ioUtil.getCmdPath()
|
||||
|
||||
|
@ -163,16 +163,17 @@ export async function rmRF(inputPath: string): Promise<void> {
|
|||
// other errors are valid
|
||||
if (err.code !== 'ENOENT') throw err
|
||||
}
|
||||
console.log('b')
|
||||
|
||||
// Shelling out fails to remove a symlink folder with missing source, this unlink catches that
|
||||
try {
|
||||
if (await ioUtil.exists(inputPath)) {
|
||||
console.log('exists')
|
||||
await ioUtil.unlink(inputPath)
|
||||
}
|
||||
} catch (err) {
|
||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||
// other errors are valid
|
||||
if (err.code !== 'ENOENT') throw err
|
||||
if (err.code !== 'ENOENT' || err.code !== 'EPERM') throw err
|
||||
}
|
||||
} else {
|
||||
let isDir = false
|
||||
|
|
Loading…
Reference in New Issue