From e048e117d41f8e5d8e6ace51e42c06bb8d279ede Mon Sep 17 00:00:00 2001 From: AraHaan Date: Wed, 21 Jul 2021 22:23:51 -0400 Subject: [PATCH] Update index.js --- index.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index a0e52d3..a0c8eb0 100644 --- a/index.js +++ b/index.js @@ -21,6 +21,15 @@ class Action return spawnSync(TOOL, ARGS, options) } + _executeInProcess(cmd) + { + var proc = this._executeCommand(cmd, { encoding: "utf-8", stdio: [process.stdin, process.stdout, process.stderr] }) + if (proc.status > 0) + { + this._printErrorAndExit(`${/error.*/.exec(proc.stdout)[0]}`) + } + } + downloadInstallScript(url, dest) { return new Promise((resolve, reject) => { @@ -67,7 +76,7 @@ class Action console.log('Download Complete.') // Windows. - this._executeCommand(`./dotnet-install.ps1 -Channel ${this.versionMajor}.${this.versionMinor} -Quality daily`) + this._executeInProcess(`./dotnet-install.ps1 -Channel ${this.versionMajor}.${this.versionMinor} -Quality daily`) } else { @@ -76,7 +85,7 @@ class Action console.log('Download Complete.') // Linux and MacOS. - this._executeCommand(`./dotnet-install.sh --channel ${this.versionMajor}.${this.versionMinor} --quality daily`) + this._executeInProcess(`./dotnet-install.sh --channel ${this.versionMajor}.${this.versionMinor} --quality daily`) } } }