Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 57f42e9cb9 | |||
| 9912202f8d | |||
| 5d560f897b | |||
| e566d60a34 | |||
| 3f2a760a30 | |||
| 4486413e9e | |||
| 54eeccaca4 | |||
| 7c48491a6b | |||
| cb2df24799 | |||
| 7d70dafa7e | |||
| 6ece840fda | |||
| 354cc5a718 | |||
| 19d5d6138b | |||
| aee8700cae | |||
| b56e7fcd67 | |||
| bc15eb10af | |||
| 640db317cb | |||
| 4e3720ed97 | |||
| 086231c43a | |||
| 92c2d702e5 | |||
| 8550e77f38 | |||
| eda924b207 | |||
| dee747db33 | |||
| 580da8ec8b | |||
| f8d90ef5be | |||
| c147b96f55 | |||
| a12b7eef44 | |||
| d4c6abaad1 | |||
| 698f089b86 |
Generated
+1
-1
@@ -29852,4 +29852,4 @@
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -29,4 +29,4 @@
|
||||
"ts-jest": "^27.0.5",
|
||||
"typescript": "^3.9.9"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
# @actions/io Releases
|
||||
|
||||
### 1.1.3
|
||||
- [Fixed a security bug where we used child_proccess.exec instead of execFile for windows](https://github.com/actions/toolkit/pull/1255)
|
||||
### 1.1.2
|
||||
- Update `lockfileVersion` to `v2` in `package-lock.json [#1020](https://github.com/actions/toolkit/pull/1020)
|
||||
|
||||
|
||||
Generated
+3
-3
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "@actions/io",
|
||||
"version": "1.1.2",
|
||||
"version": "1.1.3",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@actions/io",
|
||||
"version": "1.1.2",
|
||||
"version": "1.1.3",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@actions/io",
|
||||
"version": "1.1.2",
|
||||
"version": "1.1.3",
|
||||
"description": "Actions io lib",
|
||||
"keywords": [
|
||||
"github",
|
||||
@@ -34,4 +34,4 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
-29
@@ -4,10 +4,7 @@ import * as path from 'path'
|
||||
import {promisify} from 'util'
|
||||
import * as ioUtil from './io-util'
|
||||
|
||||
// const exec = promisify(childProcess.exec)
|
||||
const execFile = promisify(childProcess.execFile)
|
||||
const spawn = childProcess.spawn
|
||||
const subprocess = spawn('bad_command')
|
||||
|
||||
/**
|
||||
* Interface for cp/mv options
|
||||
@@ -129,34 +126,13 @@ export async function rmRF(inputPath: string): Promise<void> {
|
||||
)
|
||||
}
|
||||
try {
|
||||
const cmdPath = ioUtil.getCmdPath()
|
||||
// const cmdPath = ioUtil.getCmdPath()
|
||||
const cmdArgs = ['/s', '/q', `${inputPath}`]
|
||||
if (await ioUtil.isDirectory(inputPath, true)) {
|
||||
// deletes a dir then sets output to quiet
|
||||
spawn(cmdPath, ['/s', '/c', 'rd "%inputPath%"'], {
|
||||
shell: true,
|
||||
env: {inputPath},
|
||||
timeout: 500
|
||||
})
|
||||
subprocess.on('error', err => {
|
||||
throw new Error(`Failed to delete ${inputPath}: ${err}`)
|
||||
})
|
||||
// await exec(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, {
|
||||
// env: {inputPath}
|
||||
// })
|
||||
await execFile('rd', cmdArgs)
|
||||
} else {
|
||||
// deletes a file then pipes output
|
||||
spawn(cmdPath, ['/s', '/c', `del "%inputPath%"`], {
|
||||
shell: false,
|
||||
env: {inputPath},
|
||||
timeout: 500
|
||||
})
|
||||
|
||||
subprocess.on('error', err => {
|
||||
throw new Error(`Failed to delete ${inputPath}: ${err}`)
|
||||
})
|
||||
// await exec(`${cmdPath} /s /c "del /f /a "%inputPath%""`, {
|
||||
// env: {inputPath}
|
||||
// })
|
||||
const cmdArgsDel = ['/f', '/a', `${inputPath}`]
|
||||
await execFile('del', cmdArgsDel)
|
||||
}
|
||||
} catch (err) {
|
||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||
|
||||
Reference in New Issue
Block a user