vscode VS Code仍在任务命令中添加/d /c

5kgi1eie  于 2个月前  发布在  Vscode
关注(0)|答案(3)|浏览(32)

当所有扩展都被禁用时,这个问题是否会发生?:是的

  • VS Code 版本:1.74.2
  • 操作系统版本:Windows 11

重现步骤(在 Windows 上):

  1. 创建一个 npm 任务,启动脚本。
  2. 在用户首选项中设置 "terminal.integrated.automationProfile.windows" 为:
"terminal.integrated.automationProfile.windows": {
    "path": "nu.exe",
    "args": ["-c"],
},

这是一个示例;这也适用于例如 pwsh.exe / ["-Command"]

  1. 运行任务。
  2. VS Code 将运行 nu.exe -c /d /c yarn run name 而不是 nu.exe -c "yarn run name"
    这个问题在 #93437 中被标记为已修复,但实际上并没有。虽然提供了一个解决方法,但在我看来是不可接受的。如果我修改我的 shell 在 用户 设置中,我不应该需要修改那么多用户都会使用的 tasks.json ,而且它们的首选 shell 也不同。更重要的是,可以指定一个 shell,所以 /bin/sh 对于 Windows 上的用户不起作用,而 cmd.exe / pwsh.exe / 无论什么对于 Linux 上的用户都不起作用。这使得 terminal.integrated.automationProfile.* 基本上毫无用处。
    既然 terminal.integrated.automationProfile.* 需要一个 args 参数,为什么还要添加不需要的参数呢?我理解为什么默认值可能很好(例如,当 pathpwsh.exe 时,将 args 设置为 ["-Command"] ),但是如果首选项被明确指定,那么如果它们只与单个 shell 一起工作,为什么要在它们后面添加新的参数呢?
xwbd5t1u

xwbd5t1u1#

我今天在尝试执行一个shell脚本时遇到了这个问题,版本是1.76.2:
The terminal process "C:\msys64\msys2_shell.cmd -defterm -here -no-start -mingw64 /d /c .TransferBuild.sh" terminated with exit code: 127.

e5nszbig

e5nszbig2#

我正在使用MSYS2构建环境和Makefile工具,并且出现了相同的错误:
vscode版本1.77.3
settings.json:

"terminal.integrated.automationProfile.windows": {
		"path": "E:\\msys64\\msys2_shell.cmd",
		"args": ["-msys2", "-defterm", "-no-start", "-where", "${workspaceFolder}"],
	},
	"terminal.integrated.defaultProfile.windows": "MSYS2",
*  Executing task: 'make.exe' 'all' 
  
  /d: /d: Is a directory
  
   *  The terminal process "E:\msys64\msys2_shell.cmd -msys2 -defterm -no-start -where E:\dev\npu /d /c 'make.exe' 'all'" terminated with exit code: 126. 
   *  Terminal will be reused by tasks, press any key to close it.
ar7v8xwq

ar7v8xwq3#

版本1.85.1仍然存在这个问题。

相关问题