Skip to content

Commit d33e6b1

Browse files
committed
Remove extra prompt string added to interactive debugging session
This change removes some code that was causing an extra command prompt string to be printed to the integrated console when running an interactive debugging session. It also makes the termination of such a session more reliable. Resolves #422.
1 parent 6ea524e commit d33e6b1

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs

+10-8
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@ public class DebugAdapter : DebugAdapterBase
2626
private OutputDebouncer outputDebouncer;
2727

2828
private bool noDebug;
29+
private string arguments;
2930
private bool isRemoteAttach;
3031
private bool isAttachSession;
3132
private bool waitingForAttach;
3233
private string scriptToLaunch;
3334
private bool enableConsoleRepl;
3435
private bool ownsEditorSession;
3536
private bool executionCompleted;
36-
private string arguments;
37+
private bool isInteractiveDebugSession;
3738
private RequestContext<object> disconnectRequestContext = null;
3839

3940
public DebugAdapter(HostDetails hostDetails, ProfilePaths profilePaths)
@@ -303,13 +304,9 @@ protected async Task HandleLaunchRequest(
303304

304305
await requestContext.SendResult(null);
305306

306-
// If no script is being launched, execute an empty script to
307-
// cause the prompt string to be evaluated and displayed
308-
if (string.IsNullOrEmpty(this.scriptToLaunch))
309-
{
310-
await this.editorSession.PowerShellContext.ExecuteScriptString(
311-
"", false, true);
312-
}
307+
// If no script is being launched, mark this as an interactive
308+
// debugging session
309+
this.isInteractiveDebugSession = string.IsNullOrEmpty(this.scriptToLaunch);
313310

314311
if (this.editorSession.ConsoleService.EnableConsoleRepl)
315312
{
@@ -447,6 +444,11 @@ protected async Task HandleDisconnectRequest(
447444
{
448445
this.disconnectRequestContext = requestContext;
449446
this.editorSession.PowerShellContext.AbortExecution();
447+
448+
if (this.isInteractiveDebugSession)
449+
{
450+
await this.OnExecutionCompleted(null);
451+
}
450452
}
451453
else
452454
{

0 commit comments

Comments
 (0)