(thisArg, _arguments, P, generator)
| 20493 | * Returns promise with return code |
| 20494 | * |
| 20495 | * @param tool path to tool to exec |
| 20496 | * @param options optional exec options. See ExecOptions |
| 20497 | * @returns number |
| 20498 | */ |
| 20499 | exec() { |
| 20500 | return __awaiter4(this, void 0, void 0, function* () { |
| 20501 | if (!isRooted(this.toolPath) && (this.toolPath.includes("/") || IS_WINDOWS2 && this.toolPath.includes("\\"))) { |
| 20502 | this.toolPath = path3.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath); |
| 20503 | } |
| 20504 | this.toolPath = yield which(this.toolPath, true); |
| 20505 | return new Promise((resolve2, reject) => __awaiter4(this, void 0, void 0, function* () { |
| 20506 | this._debug(`exec tool: ${this.toolPath}`); |
| 20507 | this._debug("arguments:"); |
| 20508 | for (const arg of this.args) { |
| 20509 | this._debug(` ${arg}`); |
| 20510 | } |
| 20511 | const optionsNonNull = this._cloneExecOptions(this.options); |
| 20512 | if (!optionsNonNull.silent && optionsNonNull.outStream) { |
| 20513 | optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os3.EOL); |
| 20514 | } |
| 20515 | const state = new ExecState(optionsNonNull, this.toolPath); |
| 20516 | state.on("debug", (message) => { |
| 20517 | this._debug(message); |
| 20518 | }); |
| 20519 | if (this.options.cwd && !(yield exists(this.options.cwd))) { |
| 20520 | return reject(new Error(`The cwd: ${this.options.cwd} does not exist!`)); |
| 20521 | } |
| 20522 | const fileName = this._getSpawnFileName(); |
| 20523 | const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName)); |
| 20524 | let stdbuffer = ""; |
no test coverage detected