Emit errors concerning WSL commands
This commit is contained in:
parent
9e716bce4f
commit
11ae127dba
|
@ -37,7 +37,13 @@ $null = New-Module {
|
||||||
wsl -e printf "%q" "$result";
|
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
|
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 $?) {
|
if (-not $?) {
|
||||||
throw "The configuration could not be retrieved!";
|
Write-Error "The configuration could not be retrieved!";
|
||||||
|
} else {
|
||||||
|
if (-not ($output -and ($output | Test-Json))) {
|
||||||
|
Write-Error "The value ``$output`` is not valid JSON.";
|
||||||
|
} else {
|
||||||
|
$output | ConvertFrom-Json;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue