Fix #154: Windows下配置luanch.json启动参数program时, 路径带有空格则启动失败.#155
Merged
yinfei8 merged 1 commit intoTencent:masterfrom Apr 25, 2023
Merged
Fix #154: Windows下配置luanch.json启动参数program时, 路径带有空格则启动失败.#155yinfei8 merged 1 commit intoTencent:masterfrom
yinfei8 merged 1 commit intoTencent:masterfrom
Conversation
tidys
reviewed
Aug 4, 2023
| let progaamCmdwithArgs = args.program; | ||
| let progaamCmdwithArgs = '"' + args.program + '"'; | ||
| if (os.type() === "Windows_NT") { | ||
| progaamCmdwithArgs = '& ' + progaamCmdwithArgs; |
There was a problem hiding this comment.
progaamCmdwithArgs = & "E:/game.exe"
执行报错:此时不应有 &。
不太明白为啥这里要加个&,会有多个cmd执行的情况?
由于Windows下默认是powershell启动方式, 加上启动符 & call operator
很明显这里的判断不严谨
There was a problem hiding this comment.
我的修复代码,没提交
private isPowerShellTerminal(): boolean {
const config = vscode.workspace.getConfiguration();
const shellPath = config.get<string>("terminal.integrated.shell.windows");
return shellPath && shellPath.toLowerCase().includes("powershell.exe");
}
Contributor
Author
There was a problem hiding this comment.
如果Windows环境的默认执行shell是powershell才需要&, 如果命令执行shell不是powershell那的确没必要加&.
There was a problem hiding this comment.
os.type() === "Windows_NT"
无法判断是否为powershell
Contributor
Author
There was a problem hiding this comment.
是的, 忘了做判断, 你也提PR, 这个库维护者会及时合的.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Solution
program自动加上双引号, 可兼容Windows, Linux
由于Windows下默认是powershell启动方式, 加上启动符 & call operator
Tested
Linux & Windows均可支持带空格路径启动.