Skip to content

Commit

Permalink
dap: Do not parse program on modes that do not require it
Browse files Browse the repository at this point in the history
  • Loading branch information
lggomez committed Jul 21, 2021
1 parent 8a80a86 commit 2a95d3c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@
"replay",
"core"
],
"description": "One of `auto`, `debug`, `test`, `exec`, `remote`, `replay`, `core`. In `auto` mode, the extension will choose either `debug` or `test` depending on active editor window.",
"description": "One of `auto`, `debug`, `test`, `exec`, `replay`, `core`. In `auto` mode, the extension will choose either `debug` or `test` depending on active editor window.",
"default": "auto"
},
"traceDirPath": {
Expand Down
9 changes: 8 additions & 1 deletion src/goDebugFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,10 +517,17 @@ export function parseProgramArgSync(
launchAttachArgs: vscode.DebugConfiguration
): { program: string; dirname: string; programIsDirectory: boolean } {
const program = launchAttachArgs.program;
let programIsDirectory = false;

if (launchAttachArgs.mode === 'replay') {
// Skip program parsing on modes that do not require a program
return { program: '', dirname: '', programIsDirectory: programIsDirectory };
}

if (!program) {
throw new Error('The program attribute is missing in the debug configuration in launch.json');
}
let programIsDirectory = false;

try {
programIsDirectory = fs.lstatSync(program).isDirectory();
} catch (e) {
Expand Down

0 comments on commit 2a95d3c

Please sign in to comment.