Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can not using the xmake command in window vscode #194

Open
kyrosle opened this issue May 7, 2023 · 4 comments
Open

can not using the xmake command in window vscode #194

kyrosle opened this issue May 7, 2023 · 4 comments
Labels

Comments

@kyrosle
Copy link

kyrosle commented May 7, 2023

Xmake Version

v2.7.8+HEAD.87dff1ef4

Operating System Version and Architecture

win11

Describe Bug

using the xmake command to creat project or run the project, this error will show:

Could not access file '/d': "The system cannot find the file specified. (os error 2)"

my vscode revlant setting:

  "terminal.integrated.profiles.windows": {
    "Nu": {
      "path": "C:\\Users\\xijhe\\.cargo\\bin\\nu.exe"
  },
  "terminal.integrated.profiles.linux": {
    "Nu": {
      "path": "/home/kyros/.cargo/bin/nu"
    }
  },
  "terminal.integrated.defaultProfile.windows": "Nu",
  "terminal.integrated.defaultProfile.linux": "Nu",
  "editor.accessibilitySupport": "off",
  "scm.countBadge": "focused",
  "terminal.external.linuxExec": "/home/kyros/.cargo/bin/nu",
  "terminal.external.windowsExec": "C:\\Users\\xijhe\\.cargo\\bin\\nu.exe",

i using nushell in vscode. the the running command would have something \d \c which casuse the error.

Expected Behavior

image

Project Configuration

No response

Additional Information and Error Logs

No response

@kyrosle kyrosle added the bug label May 7, 2023
@GustafXTT
Copy link

Same here, I tried Nu and MSYS 2 Fish Shell on Windows both got the same error

Error messages:

 *  正在执行任务: xmake -w 

error: Unable to read input file: Is a directory
warning: Error while reading file /d


 *  终端进程“C:\msys64\usr\bin\fish.exe /d /c xmake -w”已终止,退出代码: 127。 
 *  终端将被任务重用,按任意键关闭。

@GustafXTT
Copy link

BTW it will work properly in Powershell in my environment

@lionyie
Copy link

lionyie commented Dec 2, 2023

This bug seems to belong to vscode. I am also waiting for a fix.
microsoft/vscode#169821

@Doekin
Copy link

Doekin commented Feb 26, 2024

该问题与vscode的API--ShellExecution有关

当我们使用xmake的相关命令时,扩展会生成对应的command,然后尝试在shell中执行。参考terminal.ts

问题在于ShellExecution会尝试将command作为参数,传递给非交互模式的shell执行。对于 bash ,会在vscode集成终端中生成任务 bash -c "xmake command",对于cmd ,则是 cmd /d /c "xmake command"
在 bash / powershell / cmd 中,这可以正常工作。而这里使用的Nushell 比较小众,vscode没有相关配置,fallback到了cmd 的模板,即尝试执行 nu /d /c "xmake command",因而产生错误

要解决这一问题,可以使用ProcessExecution或者CustomExecution以代替ShellExecution。cmake-tools的实现方法 也许能提供一些参考

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants