mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-06-14 16:16:32 +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 launchReject?: (error: any) => void;
|
||||||
protected timer?: NodeJS.Timer;
|
protected timer?: NodeJS.Timer;
|
||||||
|
|
||||||
|
serverErrorEmitted = false;
|
||||||
|
|
||||||
get isRunning(): boolean {
|
get isRunning(): boolean {
|
||||||
return !!this.process && !this.process.killed;
|
return !!this.process && !this.process.killed;
|
||||||
}
|
}
|
||||||
@ -98,7 +100,7 @@ export abstract class AbstractServer extends EventEmitter {
|
|||||||
this.emit('exit', code, signal);
|
this.emit('exit', code, signal);
|
||||||
|
|
||||||
// Code can be undefined, null or 0 and we want to ignore those values
|
// 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}`);
|
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)) {
|
if (this.serverError(data)) {
|
||||||
this.emit('error', data.split(EOL)[0]);
|
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> {
|
protected async disconnectRequest(response: DebugProtocol.DisconnectResponse, args: DebugProtocol.DisconnectArguments): Promise<void> {
|
||||||
try {
|
try {
|
||||||
this.stopSession();
|
this.stopSession();
|
||||||
if (!args || !args.restart) {
|
|
||||||
this.sendEvent(new TerminatedEvent());
|
|
||||||
}
|
|
||||||
this.sendResponse(response);
|
this.sendResponse(response);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.sendErrorResponse(response, 1, err.message);
|
this.sendErrorResponse(response, 1, err.message);
|
||||||
@ -294,7 +291,9 @@ export class CmsisDebugSession extends GDBDebugSession {
|
|||||||
this.gdbServer.removeListener('error', gdbServerErrorAccumulator);
|
this.gdbServer.removeListener('error', gdbServerErrorAccumulator);
|
||||||
this.gdbServer.on('error', message => {
|
this.gdbServer.on('error', message => {
|
||||||
logger.error(JSON.stringify(message));
|
logger.error(JSON.stringify(message));
|
||||||
|
if (!this.gdbServer.serverErrorEmitted) {
|
||||||
this.sendEvent(new TerminatedEvent());
|
this.sendEvent(new TerminatedEvent());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user