commit 8a006549c4aa0dd13cc17f6185ce30a1f4c2e71b
parent 5b3bd95a42b42d37ff94c41438eb33fdaf3d8a92
Author: Ruben Guerrero <rubengu@microsoft.com>
Date: Wed, 6 Mar 2024 17:50:00 -0800
Fix PowerShellCmdlet (#4247)
Diffstat:
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/PowerShell/CommonFiles/PowerShellCmdlet.cs b/src/PowerShell/CommonFiles/PowerShellCmdlet.cs
@@ -1,4 +1,4 @@
-// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
// <copyright file="PowerShellCmdlet.cs" company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. Licensed under the MIT License.
// </copyright>
@@ -281,6 +281,7 @@ namespace Microsoft.WinGet.Common.Command
{
try
{
+ this.pwshThreadEdi = null;
this.pwshThreadAction();
}
catch (Exception e)
@@ -596,12 +597,17 @@ namespace Microsoft.WinGet.Common.Command
this.pwshThreadActionCompleted.WaitHandle,
});
- if (this.pwshThreadEdi != null)
+ try
{
- this.pwshThreadEdi.Throw();
+ if (this.pwshThreadEdi != null)
+ {
+ this.pwshThreadEdi.Throw();
+ }
+ }
+ finally
+ {
+ this.semaphore.Release();
}
-
- this.semaphore.Release();
}
private class QueuedStream