Compare commits

...

3 commits

3 changed files with 21 additions and 9 deletions

View file

@ -110,7 +110,7 @@ $null = New-Module {
$result;
}
catch {
throw $Error;
Write-Error $Error;
}
}
}
@ -156,7 +156,7 @@ $null = New-Module {
if ($element) {
$Browser.FindElement([OpenQA.Selenium.By]::CssSelector($ButtonSelector)).Click();
} else {
throw "Unable to find download button!";
Write-Error "Unable to find download button!";
}
};
}

View file

@ -37,7 +37,13 @@ $null = New-Module {
wsl -e printf "%q" "$result";
};
Receive-Job -Wait $job;
$result = Receive-Job -Wait $job;
if ($job.State -ne ([System.Management.Automation.JobState]::Completed)) {
Write-Error "An error occurred while converting ``$Path`` to a Linux path.`nOutput: ``$result``";
}
$result;
}
<#
@ -87,11 +93,17 @@ $null = New-Module {
wsl --shell-type login -- nix --extra-experimental-features "nix-command flakes" run nixpkgs`#fish -- $args
}
fish -c ". $(ConvertTo-LinuxPath $scriptPath); $Script" | ConvertFrom-Json;
}
$output = fish -c ". $(ConvertTo-LinuxPath $scriptPath); $Script";
if (-not $?) {
throw "The configuration could not be retrieved!";
if (-not $?) {
Write-Error "The configuration could not be retrieved!";
} else {
if (-not ($output | Test-Json)) {
Write-Error "The value ``$output`` is not valid JSON.";
} else {
$output | ConvertFrom-Json;
}
}
}
}

View file

@ -51,7 +51,7 @@ $null = New-Module {
#>
function Enable-OneShotListener {
$tempTask = "PortValhalla Temp";
$action = New-ScheduledTaskAction -Execute "pwsh" -Argument (Get-StartupArguments);
$action = New-ScheduledTaskAction -Execute "pwsh" -Argument ([string](Get-StartupArguments));
schtasks /Create /SC ONEVENT /EC $logName /MO "*[System[Provider[@Name='$logName'] and EventID=$($oneShotTrigger)]]" /TR cmd.exe /TN $tempTask;
$trigger = (Get-ScheduledTask $tempTask).Triggers;
$principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -RunLevel Highest;
@ -113,7 +113,7 @@ $null = New-Module {
if (Test-Path $errorPath) {
$errorMessage = Get-Content $errorPath;
Remove-Item $errorPath;
throw $errorMessage;
Write-Error $errorMessage;
}
}