Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
When delve fails, stop the debug sessions (#774)
Browse files Browse the repository at this point in the history
* When delve fails, stop the debug sessions

* add fat arrow
  • Loading branch information
ramya-rao-a authored Feb 6, 2017
1 parent ab35627 commit 94ba09f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/debugAdapter/goDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ class Delve {
connection: Promise<RPCConnection>;
onstdout: (str: string) => void;
onstderr: (str: string) => void;
onclose: () => void;

constructor(mode: string, remotePath: string, port: number, host: string, program: string, args: string[], showLog: boolean, cwd: string, env: { [key: string]: string }, buildFlags: string, init: string) {
this.program = program;
Expand Down Expand Up @@ -268,9 +269,10 @@ class Delve {
connectClient(port, host);
}
});
this.debugProcess.on('close', function(code) {
this.debugProcess.on('close', (code) => {
// TODO: Report `dlv` crash to user.
logError('Process exiting with code: ' + code);
if (code !== 0 && this.onclose) { this.onclose(); }
});
this.debugProcess.on('error', function(err) {
reject(err);
Expand Down Expand Up @@ -388,6 +390,10 @@ class GoDebugSession extends DebugSession {
this.delve.onstderr = (str: string) => {
this.sendEvent(new OutputEvent(str, 'stderr'));
};
this.delve.onclose = () => {
this.sendErrorResponse(response, 3000, 'Failed to continue: Check the debug console for details.');
verbose('Delve is closed');
};

this.delve.connection.then(() => {
this.sendEvent(new InitializedEvent());
Expand Down

0 comments on commit 94ba09f

Please sign in to comment.