Skip to content

Commit c7b1ea6

Browse files
committed
Skip serializing our internal language kernel terminal processes on shutdown
When we quit Positron, we tear down any language runtime kernel processes (which are now managed by the terminal service host). These internal terminal processes should not be serialized/replayed on restarting Positron. This change attempts to detect those internal positron kernel terminal processes without changing the terminal service API. Issue: #213
1 parent 365e18f commit c7b1ea6

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

.vscode/launch.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,7 @@
549549
"Attach to Main Process",
550550
"Attach to Extension Host",
551551
"Attach to Shared Process",
552+
"Attach to Pty Host Process"
552553
],
553554
"preLaunchTask": "Ensure Prelaunch Dependencies",
554555
"presentation": {

extensions/jupyter-adapter/src/JupyterKernel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ export class JupyterKernel extends EventEmitter implements vscode.Disposable {
409409
const command = args.join(' ');
410410

411411
// Create environment.
412-
const env = {};
412+
const env = { POSITRON_LANGUAGE: this._spec.language };
413413
Object.assign(env, process.env, this._spec.env);
414414

415415
// We are now starting the kernel

src/vs/platform/terminal/node/ptyService.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,15 @@ export class PtyService extends Disposable implements IPtyService {
134134
async serializeTerminalState(ids: number[]): Promise<string> {
135135
const promises: Promise<ISerializedTerminalState>[] = [];
136136
for (const [persistentProcessId, persistentProcess] of this._ptys.entries()) {
137+
138+
// --- Start Positron ---
139+
// Skip serializing Positron language runtime kernel processes
140+
const positronLanguage = persistentProcess.shellLaunchConfig.env?.POSITRON_LANGUAGE;
141+
if (positronLanguage) {
142+
continue;
143+
}
144+
// --- End Positron ---
145+
137146
// Only serialize persistent processes that have had data written or performed a replay
138147
if (persistentProcess.hasWrittenData && ids.indexOf(persistentProcessId) !== -1) {
139148
promises.push(Promises.withAsyncBody<ISerializedTerminalState>(async r => {

0 commit comments

Comments
 (0)