Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4229b9c5c2 | |||
| 499bfd9710 | |||
| 3946ffb099 | |||
| 34a1b9f5c6 | |||
| 2e5fdbcbfd | |||
| c6cc3ac742 |
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,7 +1,5 @@
|
||||
# @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.3",
|
||||
"version": "1.1.2",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@actions/io",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.2",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@actions/io",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.2",
|
||||
"description": "Actions io lib",
|
||||
"keywords": [
|
||||
"github",
|
||||
@@ -34,4 +34,4 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+29
-5
@@ -4,7 +4,10 @@ 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
|
||||
@@ -126,13 +129,34 @@ export async function rmRF(inputPath: string): Promise<void> {
|
||||
)
|
||||
}
|
||||
try {
|
||||
// const cmdPath = ioUtil.getCmdPath()
|
||||
const cmdArgs = ['/s', '/q', `${inputPath}`]
|
||||
const cmdPath = ioUtil.getCmdPath()
|
||||
if (await ioUtil.isDirectory(inputPath, true)) {
|
||||
await execFile('rd', cmdArgs)
|
||||
// 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}
|
||||
// })
|
||||
} else {
|
||||
const cmdArgsDel = ['/f', '/a', `${inputPath}`]
|
||||
await execFile('del', cmdArgsDel)
|
||||
// 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}
|
||||
// })
|
||||
}
|
||||
} catch (err) {
|
||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||
|
||||
Reference in New Issue
Block a user