Skip to content

Commit 9e96d29

Browse files
authored
Track tempIntegratedConsole launch param, do not exit when session ended in this case (#625)
1 parent 406f10b commit 9e96d29

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

src/PowerShellEditorServices.Host/EditorServicesHost.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,12 @@ private void OnDebugServiceClientConnect(object sender, TcpSocketServerChannel s
303303

304304
this.debugServiceListener.Start();
305305
}
306+
else if (this.debugAdapter.IsUsingTempIntegratedConsole)
307+
{
308+
this.logger.Write(
309+
LogLevel.Normal,
310+
"Previous temp debug session ended");
311+
}
306312
else
307313
{
308314
// Exit the host process

src/PowerShellEditorServices.Protocol/DebugAdapter/LaunchRequest.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ public class LaunchRequestArguments
5252
/// </summary>
5353
public string Cwd { get; set; }
5454

55+
/// <summary>
56+
/// Gets or sets a boolean value that determines whether to create a temporary
57+
/// integrated console for the debug session. Default is false.
58+
/// </summary>
59+
public bool CreateTemporaryIntegratedConsole { get; set; }
60+
5561
/// <summary>
5662
/// Gets or sets the absolute path to the runtime executable to be used.
5763
/// Default is the runtime executable on the PATH.

src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ public DebugAdapter(
5454
this.ownsEditorSession = ownsEditorSession;
5555
}
5656

57+
/// <summary>
58+
/// Gets a boolean that indicates whether the current debug adapter is
59+
/// using a temporary integrated console.
60+
/// </summary>
61+
public bool IsUsingTempIntegratedConsole { get; private set; }
62+
5763
public void Start()
5864
{
5965
// Register all supported message types
@@ -313,6 +319,7 @@ protected async Task HandleLaunchRequest(
313319
this.scriptToLaunch = launchParams.Script ?? launchParams.Program;
314320
#pragma warning restore 618
315321
this.arguments = arguments;
322+
this.IsUsingTempIntegratedConsole = launchParams.CreateTemporaryIntegratedConsole;
316323

317324
// If the current session is remote, map the script path to the remote
318325
// machine if necessary

0 commit comments

Comments
 (0)