File tree 1 file changed +33
-1
lines changed
src/PowerShellEditorServices/Services/PowerShell/Host
1 file changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -471,7 +471,39 @@ private void RunTopLevelExecutionLoop()
471
471
task . ExecuteSynchronously ( CancellationToken . None ) ;
472
472
}
473
473
474
- RunExecutionLoop ( ) ;
474
+ if ( _hostInfo . ConsoleReplEnabled )
475
+ {
476
+ RunExecutionLoop ( ) ;
477
+ }
478
+ else
479
+ {
480
+ RunNoPromptExecutionLoop ( ) ;
481
+ }
482
+ }
483
+
484
+ private void RunNoPromptExecutionLoop ( )
485
+ {
486
+ while ( ! _shouldExit )
487
+ {
488
+ using ( CancellationScope cancellationScope = _cancellationContext . EnterScope ( isIdleScope : false ) )
489
+ {
490
+ string taskRepresentation = null ;
491
+ try
492
+ {
493
+ ISynchronousTask task = _taskQueue . Take ( cancellationScope . CancellationToken ) ;
494
+ taskRepresentation = task . ToString ( ) ;
495
+ task . ExecuteSynchronously ( cancellationScope . CancellationToken ) ;
496
+ }
497
+ catch ( OperationCanceledException )
498
+ {
499
+ // Just continue
500
+ }
501
+ catch ( Exception e )
502
+ {
503
+ _logger . LogError ( e , $ "Fatal exception occurred with task '{ taskRepresentation ?? "<null task>" } '") ;
504
+ }
505
+ }
506
+ }
475
507
}
476
508
477
509
private void RunDebugExecutionLoop ( )
You can’t perform that action at this time.
0 commit comments