Skip to content

Commit

Permalink
escape_backslash
Browse files Browse the repository at this point in the history
  • Loading branch information
ousttrue committed Aug 1, 2021
1 parent 9849009 commit 0f3974b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion extension/luaDebugSession.ts
Expand Up @@ -125,6 +125,11 @@ function makeFrameId(threadId: number, frame: number) {
return (threadId - 1) * maxStackCount + (frame - 1);
}

function escape_backslash(src: string) {
const dst = src.replace(/\\/g, "\\\\");
return dst;
}

export class LuaDebugSession extends LoggingDebugSession {
private readonly fileBreakpoints: { [file: string]: DebugProtocol.SourceBreakpoint[] | undefined } = {};
private config?: LaunchConfig;
Expand Down Expand Up @@ -228,7 +233,7 @@ export class LuaDebugSession extends LoggingDebugSession {

} else {
processExecutable = `"${this.config.program.lua}"`;
const programArgs = (this.config.args !== undefined) ? `, ${this.config.args.map(a => `\\"${a}\\"`)}` : "";
const programArgs = (this.config.args !== undefined) ? `, ${this.config.args.map(a => `\\"${escape_backslash(a)}\\"`)}` : "";
processArgs = [
"-e",
`"require('lldebugger').runFile(`
Expand Down

0 comments on commit 0f3974b

Please sign in to comment.