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

Disable the delve --log option by default. #352

Merged
merged 2 commits into from
Jun 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@
},
"default": []
},
"showLog": {
"type": "boolean",
"description": "Show log output from the delve debugger.",
"default": false
},
"cwd": {
"type": "string",
"description": "Workspace relative or absolute path to the working directory of the program being debugged. Default is the current workspace.",
Expand Down
16 changes: 12 additions & 4 deletions src/debugAdapter/goDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ interface LaunchRequestArguments extends DebugProtocol.LaunchRequestArguments {
program: string;
stopOnEntry?: boolean;
args?: string[];
showLog?: boolean;
cwd?: string;
env?: { [key: string]: string; };
mode?: string;
Expand Down Expand Up @@ -156,7 +157,7 @@ class Delve {
onstdout: (str: string) => void;
onstderr: (str: string) => void;

constructor(mode: string, remotePath: string, port: number, host: string, program: string, args: string[], cwd: string, env: { [key: string]: string }, buildFlags: string, init: string) {
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;
this.remotePath = remotePath;
this.connection = new Promise((resolve, reject) => {
Expand Down Expand Up @@ -186,7 +187,10 @@ class Delve {
if (mode === 'exec') {
dlvArgs = dlvArgs.concat([program]);
}
dlvArgs = dlvArgs.concat(['--headless=true', '--listen=' + host + ':' + port.toString(), '--log']);
dlvArgs = dlvArgs.concat(['--headless=true', '--listen=' + host + ':' + port.toString()]);
if (showLog) {
dlvArgs = dlvArgs.concat(['--log=' + showLog.toString()]);
}
if (buildFlags) {
dlvArgs = dlvArgs.concat(['--build-flags=' + buildFlags]);
}
Expand Down Expand Up @@ -231,6 +235,10 @@ class Delve {
this.debugProcess.stdout.on('data', chunk => {
let str = chunk.toString();
if (this.onstdout) { this.onstdout(str); }
if (!serverRunning) {
serverRunning = true;
connectClient(port, host);
}
});
this.debugProcess.on('close', function(code) {
// TODO: Report `dlv` crash to user.
Expand Down Expand Up @@ -323,7 +331,7 @@ class GoDebugSession extends DebugSession {
}
}

this.delve = new Delve(args.mode, remotePath, port, host, args.program, args.args, args.cwd, args.env, args.buildFlags, args.init);
this.delve = new Delve(args.mode, remotePath, port, host, args.program, args.args, args.showLog, args.cwd, args.env, args.buildFlags, args.init);
this.delve.onstdout = (str: string) => {
this.sendEvent(new OutputEvent(str, 'stdout'));
};
Expand All @@ -339,7 +347,7 @@ class GoDebugSession extends DebugSession {
log('StoppedEvent("breakpoint")');
this.sendResponse(response);
} else {
this.continueRequest(response);
this.continueRequest(<DebugProtocol.ContinueResponse>response);
}
}, err => {
this.sendErrorResponse(response, 3000, 'Failed to continue: "{e}"', { e: err.toString() });
Expand Down