Skip to content

Commit 57f3bcd

Browse files
committed
Add private contract delegate for PSES to handle idle on readline
1 parent dc38b45 commit 57f3bcd

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

PSReadLine.build.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ task LayoutModule BuildPolyfiller, BuildMainModule, {
144144
Copy-Item $binPath/Microsoft.PowerShell.PSReadLine2.dll $targetDir
145145
Copy-Item $binPath/Microsoft.PowerShell.Pager.dll $targetDir
146146

147+
if ($Configuration -eq 'Debug') {
148+
Copy-Item $binPath/*.pdb $targetDir
149+
}
150+
147151
if (Test-Path $binPath/System.Runtime.InteropServices.RuntimeInformation.dll) {
148152
Copy-Item $binPath/System.Runtime.InteropServices.RuntimeInformation.dll $targetDir
149153
} else {

PSReadLine/ReadLine.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ public partial class PSConsoleReadLine : IPSConsoleReadLineMockableMethods
4444

4545
private static readonly CancellationToken _defaultCancellationToken = new CancellationTokenSource().Token;
4646

47+
private static Action _handleIdleOverride;
48+
4749
private bool _delayedOneTimeInitCompleted;
4850

4951
private IPSConsoleReadLineMockableMethods _mockableMethods;
@@ -201,6 +203,12 @@ internal static PSKeyInfo ReadKey()
201203
if (handleId != WaitHandle.WaitTimeout && handleId != EventProcessingRequested)
202204
break;
203205

206+
if (_handleIdleOverride != null)
207+
{
208+
_handleIdleOverride();
209+
continue;
210+
}
211+
204212
// If we timed out, check for event subscribers (which is just
205213
// a hint that there might be an event waiting to be processed.)
206214
var eventSubscribers = _singleton._engineIntrinsics?.Events.Subscribers;

0 commit comments

Comments
 (0)