Compare commits

..

6 Commits

Author SHA1 Message Date
Vallie Joseph 4229b9c5c2 reversing order 2023-02-17 21:30:18 +00:00
Vallie Joseph 499bfd9710 reversing order 2023-02-17 21:27:08 +00:00
Vallie Joseph 3946ffb099 trying error throw 2023-02-17 19:27:29 +00:00
Vallie Joseph 34a1b9f5c6 removing promsify 2023-02-17 17:07:27 +00:00
Vallie Joseph 2e5fdbcbfd setting shell to false 2023-02-17 16:52:11 +00:00
Vallie Joseph c6cc3ac742 trying spawn with shell args 2023-02-17 16:33:36 +00:00
6 changed files with 36 additions and 14 deletions
+1 -1
View File
@@ -29852,4 +29852,4 @@
"dev": true
}
}
}
}
+1 -1
View File
@@ -29,4 +29,4 @@
"ts-jest": "^27.0.5",
"typescript": "^3.9.9"
}
}
}
-2
View File
@@ -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)
+3 -3
View File
@@ -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"
}
}
}
}
+2 -2
View File
@@ -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
View File
@@ -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