mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-06-04 19:26:33 +00:00
Don't send 'terminated' on 'disconnect' (arduino/arduino-pro-ide#183)
This commit is contained in:
parent
576f96a502
commit
828379cdc9
@ -40,6 +40,8 @@ export abstract class AbstractServer extends EventEmitter {
|
||||
protected launchReject?: (error: any) => void;
|
||||
protected timer?: NodeJS.Timer;
|
||||
|
||||
serverErrorEmitted = false;
|
||||
|
||||
get isRunning(): boolean {
|
||||
return !!this.process && !this.process.killed;
|
||||
}
|
||||
@ -98,7 +100,7 @@ export abstract class AbstractServer extends EventEmitter {
|
||||
this.emit('exit', code, signal);
|
||||
|
||||
// Code can be undefined, null or 0 and we want to ignore those values
|
||||
if (!!code) {
|
||||
if (!!code && !this.serverErrorEmitted) {
|
||||
this.emit('error', `GDB server stopped unexpectedly with exit code ${code}`);
|
||||
}
|
||||
}
|
||||
@ -141,6 +143,7 @@ export abstract class AbstractServer extends EventEmitter {
|
||||
|
||||
if (this.serverError(data)) {
|
||||
this.emit('error', data.split(EOL)[0]);
|
||||
this.serverErrorEmitted = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,9 +208,6 @@ export class CmsisDebugSession extends GDBDebugSession {
|
||||
protected async disconnectRequest(response: DebugProtocol.DisconnectResponse, args: DebugProtocol.DisconnectArguments): Promise<void> {
|
||||
try {
|
||||
this.stopSession();
|
||||
if (!args || !args.restart) {
|
||||
this.sendEvent(new TerminatedEvent());
|
||||
}
|
||||
this.sendResponse(response);
|
||||
} catch (err) {
|
||||
this.sendErrorResponse(response, 1, err.message);
|
||||
@ -294,7 +291,9 @@ export class CmsisDebugSession extends GDBDebugSession {
|
||||
this.gdbServer.removeListener('error', gdbServerErrorAccumulator);
|
||||
this.gdbServer.on('error', message => {
|
||||
logger.error(JSON.stringify(message));
|
||||
this.sendEvent(new TerminatedEvent());
|
||||
if (!this.gdbServer.serverErrorEmitted) {
|
||||
this.sendEvent(new TerminatedEvent());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user