提交 0d45ae7a 编写于 作者: I isidor

If the restart is automatic disconnect, otherwise send the terminate signal

fixes #55064
上级 9c4e41fc
......@@ -166,7 +166,7 @@ export class DebugService implements debug.IDebugService {
});
} else {
const root = raw.root;
raw.dispose();
raw.disconnect().done(undefined, errors.onUnexpectedError);
this.doCreateSession(root, { resolved: session.configuration, unresolved: session.unresolvedConfiguration }, session.getId());
}
......@@ -291,7 +291,7 @@ export class DebugService implements debug.IDebugService {
return raw.configurationDone().done(null, e => {
// Disconnect the debug session on configuration done error #10596
if (raw) {
raw.dispose();
raw.disconnect().done(undefined, errors.onUnexpectedError);
}
this.notificationService.error(e.message);
});
......@@ -341,7 +341,7 @@ export class DebugService implements debug.IDebugService {
if (event.body && event.body.restart && session) {
this.restartSession(session, event.body.restart).done(null, err => this.notificationService.error(err.message));
} else {
raw.dispose();
raw.disconnect().done(undefined, errors.onUnexpectedError);
}
}
}));
......@@ -973,7 +973,7 @@ export class DebugService implements debug.IDebugService {
this.telemetryService.publicLog('debugMisconfiguration', { type: resolved ? resolved.type : undefined, error: errorMessage });
this.updateStateAndEmit(raw.getId(), debug.State.Inactive);
if (!raw.disconnected) {
raw.dispose();
raw.disconnect();
} else if (session) {
this.model.removeSession(session.getId());
}
......@@ -1110,7 +1110,8 @@ export class DebugService implements debug.IDebugService {
// Do not run preLaunch and postDebug tasks for automatic restarts
this.skipRunningTask = !!restartData;
return session.raw.terminate(true).then(() => {
// If the restart is automatic disconnect, otherwise send the terminate signal #55064
return (!restartData ? (<RawDebugSession>session.raw).disconnect(true) : session.raw.terminate(true)).then(() => {
if (strings.equalsIgnoreCase(session.configuration.type, 'extensionHost') && session.raw.root) {
return this.broadcastService.broadcast({
channel: EXTENSION_RELOAD_BROADCAST_CHANNEL,
......
......@@ -348,8 +348,7 @@ export class RawDebugSession implements IRawSession {
return this.send('terminate', { restart });
}
this.dispose(restart);
return TPromise.as(null);
return this.disconnect(restart);
}
public setBreakpoints(args: DebugProtocol.SetBreakpointsArguments): TPromise<DebugProtocol.SetBreakpointsResponse> {
......@@ -475,24 +474,25 @@ export class RawDebugSession implements IRawSession {
});
}
public dispose(restart = false): void {
public disconnect(restart = false): TPromise<any> {
if (this.disconnected) {
this.stopServer().done(undefined, errors.onUnexpectedError);
} else {
return this.stopServer();
}
// Cancel all sent promises on disconnect so debug trees are not left in a broken state #3666.
// Give a 1s timeout to give a chance for some promises to complete.
setTimeout(() => {
this.sentPromises.forEach(p => p && p.cancel());
this.sentPromises = [];
}, 1000);
if (this.debugAdapter && !this.disconnected) {
// point of no return: from now on don't report any errors
this.disconnected = true;
this.send('disconnect', { restart }, false).then(() => this.stopServer(), () => this.stopServer()).done(undefined, errors.onUnexpectedError);
}
// Cancel all sent promises on disconnect so debug trees are not left in a broken state #3666.
// Give a 1s timeout to give a chance for some promises to complete.
setTimeout(() => {
this.sentPromises.forEach(p => p && p.cancel());
this.sentPromises = [];
}, 1000);
if (this.debugAdapter && !this.disconnected) {
// point of no return: from now on don't report any errors
this.disconnected = true;
return this.send('disconnect', { restart }, false).then(() => this.stopServer(), () => this.stopServer());
}
return TPromise.as(null);
}
private stopServer(): TPromise<any> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册