Skip to content

Commit 81d31e0

Browse files
committed
Add private contract delegate for PSES to handle idle on readline
1 parent 0ae04cd commit 81d31e0

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;
@@ -202,6 +204,12 @@ internal static PSKeyInfo ReadKey()
202204
if (handleId != WaitHandle.WaitTimeout && handleId != EventProcessingRequested)
203205
break;
204206

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

0 commit comments

Comments
 (0)