mirror of
https://github.com/ChrisTitusTech/winutil
synced 2026-04-06 06:38:31 +00:00
Update-Compile (#3922)
* Update Compile.ps1 * Update Compile.ps1 * Update Compile.ps1 * Update Compile.ps1 * Update Compile.ps1 * Update Compile.ps1
This commit is contained in:
15
Compile.ps1
15
Compile.ps1
@@ -12,12 +12,8 @@ $OFS = "`r`n"
|
|||||||
$scriptname = "winutil.ps1"
|
$scriptname = "winutil.ps1"
|
||||||
$workingdir = $PSScriptRoot
|
$workingdir = $PSScriptRoot
|
||||||
|
|
||||||
Push-Location
|
|
||||||
Set-Location $workingdir
|
|
||||||
|
|
||||||
# Variable to sync between runspaces
|
# Variable to sync between runspaces
|
||||||
$sync = [Hashtable]::Synchronized(@{})
|
$sync = [Hashtable]::Synchronized(@{})
|
||||||
$sync.PSScriptRoot = $workingdir
|
|
||||||
$sync.configs = @{}
|
$sync.configs = @{}
|
||||||
|
|
||||||
function Update-Progress {
|
function Update-Progress {
|
||||||
@@ -132,19 +128,12 @@ try {
|
|||||||
} catch {
|
} catch {
|
||||||
Write-Warning "Syntax Validation for 'winutil.ps1' has failed"
|
Write-Warning "Syntax Validation for 'winutil.ps1' has failed"
|
||||||
Write-Host "$($Error[0])" -ForegroundColor Red
|
Write-Host "$($Error[0])" -ForegroundColor Red
|
||||||
Pop-Location # Restore previous location before exiting...
|
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
Write-Progress -Activity "Validating" -Completed
|
Write-Progress -Activity "Validating" -Completed
|
||||||
|
|
||||||
if ($run) {
|
if ($run) {
|
||||||
$script = "& '$workingdir\$scriptname' $Arguments"
|
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
|
||||||
|
.\Winutil.ps1 $Arguments
|
||||||
$powershellcmd = if (Get-Command pwsh -ErrorAction SilentlyContinue) { "pwsh" } else { "powershell" }
|
|
||||||
$processCmd = if (Get-Command wt.exe -ErrorAction SilentlyContinue) { "wt.exe" } else { $powershellcmd }
|
|
||||||
|
|
||||||
Start-Process $processCmd -ArgumentList "$powershellcmd -NoProfile -Command $script"
|
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
Pop-Location
|
|
||||||
|
|||||||
Reference in New Issue
Block a user