Skip to content

Commit 1a68402

Browse files
committed
bug fix
1 parent 6f824c3 commit 1a68402

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

src/debugger/AttachDebugSession.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,22 @@ export class AttachDebugSession extends LoggingDebugSession implements ExprEvalu
6868

6969
protected launchRequest(response: DebugProtocol.LaunchResponse, args: EmmyLaunchRequesetArguments): void {
7070
this.initEnv(args);
71-
cp.exec(`${emmyArchExe} arch -file ${args.program}`, (err, stdout) => {
72-
const isX86 = stdout === "1";
73-
const arch = isX86 ? "x86" : "x64";
74-
const toolExe = `${args.extensionPath}/server/windows/${arch}/emmy.tool.exe`;
75-
const argList = [toolExe, "-m", "run", "-c", args.program, "-e", emmyLua, '-w', args.workingDir, "--console", "true"];
76-
if (args.arguments.length > 0) {
77-
argList.push("-a", args.arguments.join(" "));
71+
var isX86 = true;
72+
cp.exec(`${emmyArchExe} arch -file ${args.program}`, (err, stdout) => isX86 = stdout === "1").on("exit", code => {
73+
if (code === 0xffffffff) {
74+
this.sendEvent(new TerminatedEvent());
75+
} else {
76+
const arch = isX86 ? "x86" : "x64";
77+
const toolExe = `${args.extensionPath}/server/windows/${arch}/emmy.tool.exe`;
78+
const argList = [toolExe, "-m", "run", "-c", args.program, "-e", emmyLua, '-w', args.workingDir, "--console", "true"];
79+
if (args.arguments.length > 0) {
80+
argList.push("-a", args.arguments.join(" "));
81+
}
82+
const ls = this.runDebugger(argList.join(" "), args, response);
83+
this.once("initialized", () => {
84+
ls.stdin.write("resume\n");
85+
});
7886
}
79-
const ls = this.runDebugger(argList.join(" "), args, response);
80-
this.once("initialized", () => {
81-
ls.stdin.write("resume\n");
82-
});
8387
});
8488
}
8589

@@ -242,6 +246,9 @@ export class AttachDebugSession extends LoggingDebugSession implements ExprEvalu
242246
case DebugMessageId.SetBreakpoint: {
243247
break;
244248
}
249+
case DebugMessageId.CreateVM: {
250+
break;
251+
}
245252
default: this.log(msg);
246253
}
247254
}

0 commit comments

Comments
 (0)