mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-04-03 18:53:18 +08:00
Exec: throw error when cwd option does not exist (#793)
* Exec: throw error when cwd option does not exist * Simplify promise rejection
This commit is contained in:
@@ -414,7 +414,7 @@ export class ToolRunner extends events.EventEmitter {
|
||||
// otherwise verify it exists (add extension on Windows if necessary)
|
||||
this.toolPath = await io.which(this.toolPath, true)
|
||||
|
||||
return new Promise<number>((resolve, reject) => {
|
||||
return new Promise<number>(async (resolve, reject) => {
|
||||
this._debug(`exec tool: ${this.toolPath}`)
|
||||
this._debug('arguments:')
|
||||
for (const arg of this.args) {
|
||||
@@ -433,6 +433,10 @@ export class ToolRunner extends events.EventEmitter {
|
||||
this._debug(message)
|
||||
})
|
||||
|
||||
if (this.options.cwd && !(await ioUtil.exists(this.options.cwd))) {
|
||||
return reject(new Error(`The cwd: ${this.options.cwd} does not exist!`))
|
||||
}
|
||||
|
||||
const fileName = this._getSpawnFileName()
|
||||
const cp = child.spawn(
|
||||
fileName,
|
||||
|
||||
Reference in New Issue
Block a user