Bash 工具在 Windows git bash 环境下,2>&1 重定向语法被错误解析为命令行参数

复现步骤:

  1. Windows 系统,使用 git bash (D:\Git\Git\bin\bash.exe)
  2. 在 Qoder CLI 中执行任意命令加 2>&1,例如 mvn clean compile 2>&1
  3. Maven 报错:Unknown lifecycle phase “2”

原因分析:
Qoder CLI 的 Bash 工具在 Windows git bash 下,2>&1 重定向没有被正确识别为 shell 重定向语法,而是被当作普通参数传递给了命令本身。例如 mvn compile 2>&1 实际执行成了 mvn compile
2,导致 Maven 把 “2” 当成了 lifecycle phase。

同样的命令 mvn clean compile -q(不带 2>&1)则完全正常。

影响范围: 所有在 Windows git bash 下使用 2>&1、> file 2>&1 等重定向语法的命令。

版本:0.2.8