diff options
| author | OpportunityLiu <[email protected]> | 2019-06-06 18:18:08 +0800 |
|---|---|---|
| committer | OpportunityLiu <[email protected]> | 2019-06-06 18:18:08 +0800 |
| commit | 3983a4c766b127cc50c36bb36ad7a779e3ce9432 (patch) | |
| tree | a4734d29d24b8f96d66869ff1ed0ee50102ba8ab /scripts | |
| parent | f626059565d8a99d963b64927800d4d2e0020c73 (diff) | |
improve script
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/get.ps1 | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/scripts/get.ps1 b/scripts/get.ps1 index 3b31701dc..5dc333c6c 100644 --- a/scripts/get.ps1 +++ b/scripts/get.ps1 @@ -46,7 +46,7 @@ function checkTempAccess { } catch { writeErrorTip 'Cannot write to temp path' writeErrorTip 'Please set environment var "TMP" to another path' - myExit 1 + throw } } @@ -58,7 +58,7 @@ function xmakeInstall { } catch { writeErrorTip 'Download failed!' writeErrorTip 'Check your network or... the news of S3 break' - myExit 1 + throw } Write-Host 'Start installation... Hope your antivirus doesn''t trouble' $installdir = Join-Path $env:HOME 'xmake' @@ -68,7 +68,7 @@ function xmakeInstall { } catch { writeErrorTip 'Install failed!' writeErrorTip 'Close your antivirus then try again' - myExit 1 + throw } finally { Remove-Item $outfile -ErrorAction SilentlyContinue } @@ -80,7 +80,7 @@ function xmakeInstall { } catch { writeErrorTip 'Everything is showing installation has finished' writeErrorTip 'But xmake could not run... Why?' - myExit 1 + throw } } @@ -92,7 +92,7 @@ function xmakeSelfBuild { } catch { writeErrorTip 'Pull Failed!' writeErrorTip 'xmake is now available but may not be newest' - myExit + throw } Write-Host 'Expanding archive...' $oldpwd = Get-Location @@ -110,6 +110,7 @@ function xmakeSelfBuild { } catch { writeErrorTip 'Update Failed!' writeErrorTip 'xmake is now available but may not be newest' + throw } finally { Set-Location $oldpwd -ErrorAction SilentlyContinue Remove-Item $outfile -ErrorAction SilentlyContinue @@ -176,11 +177,18 @@ function registerTabCompletion { } } -checkTempAccess -xmakeInstall +try { + checkTempAccess + xmakeInstall +} catch { + myExit 1 +} + if (-not $env:CI) { - xmakeSelfBuild + try { + xmakeSelfBuild + } catch { } # continue registerTabCompletion } |
