Skip to content

Commit bec103e

Browse files
committed
error handling
1 parent 3a522ca commit bec103e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/debugger/AttachDebugSession.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ export class AttachDebugSession extends EmmyDebugSession implements ExprEvaluato
106106
const ls = cp.exec(cmd).on("error", e => {
107107
this.sendEvent(new OutputEvent(e.message));
108108
this.sendEvent(new TerminatedEvent());
109+
}).on("exit", code => {
110+
if (code !== 0) {
111+
this.sendEvent(new TerminatedEvent());
112+
}
109113
});
110114
ls.stdout.on("data", (stdout:string) => {
111115
this.sendEvent(new OutputEvent(stdout));

src/debugger/AttachDebuggerProvider.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ export class AttachDebuggerProvider implements vscode.DebugConfigurationProvider
3939
debugConfiguration.sourcePaths = this.getSourceRoots();
4040
if (debugConfiguration.type === "emmylua_launch") {
4141
if (this.isNullOrEmpty(debugConfiguration.workingDir)) {
42-
debugConfiguration.workingDir = "%workspaceRoot%";
42+
var list = vscode.workspace.workspaceFolders!.map(f => { return f.uri.fsPath; });
43+
if (list.length > 0) {
44+
debugConfiguration.workingDir = list[0];
45+
}
4346
}
4447
if (!debugConfiguration.arguments) {
4548
debugConfiguration.arguments = [];

0 commit comments

Comments
 (0)