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

Commit

Permalink
Merge pull request #352 from bawr/patch-1
Browse files Browse the repository at this point in the history
Disable the delve --log option by default.
  • Loading branch information
lukehoban committed Jun 7, 2016
2 parents 175cc72 + 5d4688f commit 9abf0fb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,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
14 changes: 11 additions & 3 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 Down

0 comments on commit 9abf0fb

Please sign in to comment.