From a5cf2d39ce26e3e701bc82d8166cd057659c4ae4 Mon Sep 17 00:00:00 2001 From: jantari Date: Fri, 19 Jan 2024 22:31:32 +0100 Subject: [PATCH] close StdIn stream of external executables (fix #103) --- private/Invoke-PackageCommand.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/private/Invoke-PackageCommand.ps1 b/private/Invoke-PackageCommand.ps1 index b938a7d..eb166c2 100644 --- a/private/Invoke-PackageCommand.ps1 +++ b/private/Invoke-PackageCommand.ps1 @@ -115,11 +115,13 @@ $process.StartInfo.WorkingDirectory = $WorkingDirectory $process.StartInfo.FileName = $Executable $process.StartInfo.Arguments = $Arguments + $process.StartInfo.RedirectStandardInput = $true $process.StartInfo.RedirectStandardOutput = $true $process.StartInfo.RedirectStandardError = $true if ($FallbackToShellExecute) { $process.StartInfo.UseShellExecute = $true + $process.StartInfo.RedirectStandardInput = $false $process.StartInfo.RedirectStandardOutput = $false $process.StartInfo.RedirectStandardError = $false } @@ -154,6 +156,8 @@ # See issue #25 and https://stackoverflow.com/questions/11531068/powershell-capturing-standard-out-and-error-with-process-object $StdOutAsync = $process.StandardOutput.ReadToEndAsync() $StdErrAsync = $process.StandardError.ReadToEndAsync() + # https://github.com/jantari/LSUClient/issues/103 + $process.StandardInput.Close() } $process.WaitForExit()