mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix deadlock when piping to shell associated file extension (#19940)
This commit is contained in:
@@ -604,19 +604,6 @@ namespace System.Management.Automation
|
||||
{
|
||||
_nativeProcess = new Process() { StartInfo = startInfo };
|
||||
_nativeProcess.Start();
|
||||
if (UpstreamIsNativeCommand)
|
||||
{
|
||||
SemaphoreSlim processInitialized = _processInitialized;
|
||||
if (processInitialized is null)
|
||||
{
|
||||
lock (_sync)
|
||||
{
|
||||
processInitialized = _processInitialized ??= new SemaphoreSlim(0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
processInitialized?.Release();
|
||||
}
|
||||
}
|
||||
catch (Win32Exception)
|
||||
{
|
||||
@@ -695,6 +682,12 @@ namespace System.Management.Automation
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (UpstreamIsNativeCommand)
|
||||
{
|
||||
_processInitialized ??= new SemaphoreSlim(0, 1);
|
||||
_processInitialized.Release();
|
||||
}
|
||||
}
|
||||
|
||||
if (this.Command.MyInvocation.PipelinePosition < this.Command.MyInvocation.PipelineLength)
|
||||
|
||||
Reference in New Issue
Block a user