@@ -100,7 +100,7 @@ public EditorServicesConsolePSHost(
100
100
101
101
public override void EnterNestedPrompt ( )
102
102
{
103
- PushPowerShell ( _psFactory . CreateNestedPowerShell ( CurrentRunspace ) , PowerShellFrameType . Nested ) ;
103
+ PushPowerShellAndRunLoop ( _psFactory . CreateNestedPowerShell ( CurrentRunspace ) , PowerShellFrameType . Nested ) ;
104
104
}
105
105
106
106
public override void ExitNestedPrompt ( )
@@ -127,7 +127,7 @@ public void PopRunspace()
127
127
public void PushRunspace ( Runspace runspace )
128
128
{
129
129
IsRunspacePushed = true ;
130
- PushPowerShell ( _psFactory . CreatePowerShellForRunspace ( runspace ) , PowerShellFrameType . Remote ) ;
130
+ PushPowerShellAndRunLoop ( _psFactory . CreatePowerShellForRunspace ( runspace ) , PowerShellFrameType . Remote ) ;
131
131
}
132
132
133
133
public override void SetShouldExit ( int exitCode )
@@ -145,7 +145,7 @@ public void PushInitialPowerShell()
145
145
146
146
internal void PushNonInteractivePowerShell ( )
147
147
{
148
- PushPowerShell ( _psFactory . CreateNestedPowerShell ( CurrentRunspace ) , PowerShellFrameType . Nested | PowerShellFrameType . NonInteractive ) ;
148
+ PushPowerShellAndRunLoop ( _psFactory . CreateNestedPowerShell ( CurrentRunspace ) , PowerShellFrameType . Nested | PowerShellFrameType . NonInteractive ) ;
149
149
}
150
150
151
151
internal void CancelCurrentPrompt ( )
@@ -193,8 +193,6 @@ await ExecutionService.ExecuteDelegateAsync((pwsh, delegateCancellation) =>
193
193
{
194
194
await SetInitialWorkingDirectoryAsync ( hostStartOptions . InitialWorkingDirectory , CancellationToken . None ) . ConfigureAwait ( false ) ;
195
195
}
196
-
197
- _consoleReplRunner ? . StartRepl ( ) ;
198
196
}
199
197
200
198
private void SetExit ( )
@@ -212,12 +210,18 @@ private void SetExit()
212
210
}
213
211
}
214
212
215
- private void PushPowerShell ( SMA . PowerShell pwsh , PowerShellFrameType frameType )
213
+ private void PushPowerShellAndRunLoop ( SMA . PowerShell pwsh , PowerShellFrameType frameType )
216
214
{
217
215
// TODO: Improve runspace origin detection here
218
216
RunspaceOrigin runspaceOrigin = pwsh . Runspace . RunspaceIsRemote ? RunspaceOrigin . EnteredProcess : RunspaceOrigin . Local ;
219
217
var runspaceInfo = RunspaceInfo . CreateFromPowerShell ( _logger , pwsh , runspaceOrigin , _localComputerName ) ;
220
- PushPowerShell ( new PowerShellContextFrame ( pwsh , runspaceInfo , frameType ) ) ;
218
+ PushPowerShellAndRunLoop ( new PowerShellContextFrame ( pwsh , runspaceInfo , frameType ) ) ;
219
+ }
220
+
221
+ private void PushPowerShellAndRunLoop ( PowerShellContextFrame frame )
222
+ {
223
+ PushPowerShell ( frame ) ;
224
+ _pipelineExecutor . RunPowerShellLoop ( frame . FrameType ) ;
221
225
}
222
226
223
227
private void PushPowerShell ( PowerShellContextFrame frame )
@@ -229,8 +233,6 @@ private void PushPowerShell(PowerShellContextFrame frame)
229
233
AddRunspaceEventHandlers ( frame . PowerShell . Runspace ) ;
230
234
231
235
_psFrameStack . Push ( frame ) ;
232
-
233
- _pipelineExecutor . RunPowerShellLoop ( frame . FrameType ) ;
234
236
}
235
237
236
238
internal void PopPowerShell ( )
@@ -271,7 +273,7 @@ private void OnDebuggerStopped(object sender, DebuggerStopEventArgs debuggerStop
271
273
try
272
274
{
273
275
CurrentPowerShell . WaitForRemoteOutputIfNeeded ( ) ;
274
- PushPowerShell ( _psFactory . CreateNestedPowerShell ( CurrentRunspace ) , PowerShellFrameType . Debug | PowerShellFrameType . Nested ) ;
276
+ PushPowerShellAndRunLoop ( _psFactory . CreateNestedPowerShell ( CurrentRunspace ) , PowerShellFrameType . Debug | PowerShellFrameType . Nested ) ;
275
277
CurrentPowerShell . ResumeRemoteOutputIfNeeded ( ) ;
276
278
}
277
279
finally
0 commit comments