Skip to content

Commit d83436b

Browse files
committed
Add comment to PowerShellExtensions
1 parent f67e8c1 commit d83436b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/PowerShellEditorServices/Services/PowerShell/Utility/PowerShellExtensions.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,21 @@ public static void InvokeCommand(this PowerShell pwsh, PSCommand psCommand)
7171
pwsh.InvokeAndClear();
7272
}
7373

74+
/// <summary>
75+
/// When running a remote session, waits for remote processing and output to complete.
76+
/// </summary>
7477
public static void WaitForRemoteOutputIfNeeded(this PowerShell pwsh)
7578
{
7679
if (!pwsh.Runspace.RunspaceIsRemote)
7780
{
7881
return;
7982
}
8083

84+
// These methods are required when running commands remotely.
85+
// Remote rendering from command output is done asynchronously.
86+
// So to ensure we wait for output to be rendered,
87+
// we need these methods to wait for rendering.
88+
// PowerShell does this in its own implementation: https://github.com/PowerShell/PowerShell/blob/883ca98dd74ea13b3d8c0dd62d301963a40483d6/src/System.Management.Automation/engine/debugger/debugger.cs#L4628-L4652
8189
s_waitForServicingComplete(pwsh);
8290
s_suspendIncomingData(pwsh);
8391
}

0 commit comments

Comments
 (0)