Skip to content

Commit

Permalink
Update to emit error event
Browse files Browse the repository at this point in the history
  • Loading branch information
luketomlinson committed May 6, 2021
1 parent b0d6dbd commit f888302
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/exec/src/toolrunner.ts
Expand Up @@ -421,6 +421,11 @@ export class ToolRunner extends events.EventEmitter {
this._debug(` ${arg}`)
}

this.on('error', (error: Error) => {
reject(error)
})


const optionsNonNull = this._cloneExecOptions(this.options)
if (!optionsNonNull.silent && optionsNonNull.outStream) {
optionsNonNull.outStream.write(
Expand All @@ -434,7 +439,8 @@ export class ToolRunner extends events.EventEmitter {
})

if (this.options.cwd && !(await ioUtil.exists(this.options.cwd))) {
throw new Error(`The cwd: ${this.options.cwd} does not exist!`)
this.emit('error', new Error(`The cwd: ${this.options.cwd} does not exist!`))
return
}

const fileName = this._getSpawnFileName()
Expand Down

0 comments on commit f888302

Please sign in to comment.