From 4bcb88f1da48639c9549577a7f9caa323ed3f11f Mon Sep 17 00:00:00 2001 From: xu_yanfeng Date: Fri, 4 Aug 2023 11:54:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dpowershell=E7=9A=84=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- luahelper-vscode/src/debug/luaDebug.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/luahelper-vscode/src/debug/luaDebug.ts b/luahelper-vscode/src/debug/luaDebug.ts index 9723076..0cca039 100644 --- a/luahelper-vscode/src/debug/luaDebug.ts +++ b/luahelper-vscode/src/debug/luaDebug.ts @@ -17,7 +17,7 @@ import * as Net from 'net'; import { DataProcessor } from './dataProcessor'; import { DebugLogger } from '../common/logManager'; //import { StatusBarManager } from '../common/statusBarManager'; -import { LineBreakpoint, ConditionBreakpoint, LogPoint } from './breakpoint'; +import { LineBreakpoint, ConditionBreakpoint, LogPoint } from './breakPoint'; import { Tools } from '../common/tools'; //import { UpdateManager } from './updateManager'; import { ThreadManager } from '../common/threadManager'; @@ -349,15 +349,15 @@ export class LuaDebugSession extends LoggingDebugSession { env: {}, }); - let progaamCmdwithArgs = '"' + args.program + '"'; - if (os.type() === "Windows_NT") { - progaamCmdwithArgs = '& ' + progaamCmdwithArgs; + let programCmdWithArgs = '"' + args.program + '"'; + if (this.isPowerShellTerminal()) { + programCmdWithArgs = '& ' + programCmdWithArgs; } for (const arg of args.args) { - progaamCmdwithArgs = progaamCmdwithArgs + " " + arg; + programCmdWithArgs = programCmdWithArgs + " " + arg; } - this._programTermianl.sendText(progaamCmdwithArgs , true); + this._programTermianl.sendText(programCmdWithArgs , true); this._programTermianl.show(); }else{ let progError = "[Warning] 配置文件 launch.json 中的 program 路径有误: \n"; @@ -369,7 +369,12 @@ export class LuaDebugSession extends LoggingDebugSession { } } } - + + private isPowerShellTerminal(): boolean { + const config = vscode.workspace.getConfiguration(); + const shellPath = config.get("terminal.integrated.shell.windows"); + return shellPath && shellPath.toLowerCase().includes("powershell.exe"); + } private startServer(sendArgs){ this.connectionFlag = false; //3. 启动Adapter的socket | VSCode = Server ; Debugger = Client