summaryrefslogtreecommitdiffstats
path: root/src/init
diff options
context:
space:
mode:
authorDavid Knaack <davidkna@users.noreply.github.com>2021-02-13 19:31:54 +0100
committerGitHub <noreply@github.com>2021-02-13 19:31:54 +0100
commita24e843ee09ea021a09ce4249081407bb4d59756 (patch)
tree12f1f99145ba472ce77276ffa8c66fbe154549f8 /src/init
parentcf9c89ef6b2573ce0db50062148e0e1186852a02 (diff)
fix(init): make log messages on pwsh visible again (#2295)
Diffstat (limited to 'src/init')
-rw-r--r--src/init/starship.ps113
1 files changed, 12 insertions, 1 deletions
diff --git a/src/init/starship.ps1 b/src/init/starship.ps1
index fd1604609..e5a1fb148 100644
--- a/src/init/starship.ps1
+++ b/src/init/starship.ps1
@@ -27,6 +27,7 @@ function global:prompt {
$startInfo = [System.Diagnostics.ProcessStartInfo]::new($Executable);
$startInfo.StandardOutputEncoding = [System.Text.Encoding]::UTF8;
$startInfo.RedirectStandardOutput = $true;
+ $startInfo.RedirectStandardError = $true;
$startInfo.CreateNoWindow = $true;
$startInfo.UseShellExecute = $false;
if ($startInfo.ArgumentList.Add) {
@@ -48,7 +49,17 @@ function global:prompt {
}
$startInfo.Arguments = $escaped -Join ' ';
}
- [System.Diagnostics.Process]::Start($startInfo).StandardOutput.ReadToEnd();
+ $process = [System.Diagnostics.Process]::Start($startInfo)
+
+ # stderr isn't displayed with this style of invocation
+ # Manually write it to console
+ $stderr = $process.StandardError.ReadToEnd().Trim()
+ if ($stderr -ne '') {
+ # Write-Error doesn't work here
+ $host.ui.WriteErrorLine($stderr)
+ }
+
+ $process.StandardOutput.ReadToEnd();
}
$origDollarQuestion = $global:?