()
| 7997 | this.failOnStandardErr = failOnStandardErr; |
| 7998 | } |
| 7999 | executeFile() { |
| 8000 | return __awaiter(this, void 0, void 0, function* () { |
| 8001 | const error = []; |
| 8002 | const options = { |
| 8003 | listeners: { |
| 8004 | stderr: (data) => { |
| 8005 | if (error.length < 10) { |
| 8006 | // Truncate to at most 1000 bytes |
| 8007 | if (data.length > 1000) { |
| 8008 | error.push(`${data.toString('utf8', 0, 1000)}<truncated>`); |
| 8009 | } |
| 8010 | else { |
| 8011 | error.push(data.toString('utf8')); |
| 8012 | } |
| 8013 | } |
| 8014 | else if (error.length === 10) { |
| 8015 | error.push('Additional writes to stderr truncated'); |
| 8016 | } |
| 8017 | } |
| 8018 | } |
| 8019 | }; |
| 8020 | const scriptToExecute = new ScriptBuilder_1.default().getInlineScriptFile(this.inlineScript, this.errorActionPreference); |
| 8021 | ScriptRunner.filePath = yield FileUtils_1.default.createScriptFile(scriptToExecute); |
| 8022 | core.debug(`script file to run: ${ScriptRunner.filePath}`); |
| 8023 | const exitCode = yield PowerShellToolRunner_1.default.executePowerShellScriptBlock(ScriptRunner.filePath, options); |
| 8024 | if (exitCode !== 0) { |
| 8025 | core.setOutput(`Azure PowerShell exited with code:`, exitCode.toString()); |
| 8026 | if (this.failOnStandardErr) { |
| 8027 | error.forEach((err) => { |
| 8028 | core.error(err); |
| 8029 | }); |
| 8030 | throw new Error(`Standard error stream contains one or more lines`); |
| 8031 | } |
| 8032 | } |
| 8033 | }); |
| 8034 | } |
| 8035 | } |
| 8036 | exports["default"] = ScriptRunner; |
| 8037 |
no test coverage detected