buildMSYS2Command constructs a command to run in MSYS2/bash environment.
(displayCmd *string)
| 68 | |
| 69 | // buildMSYS2Command constructs a command to run in MSYS2/bash environment. |
| 70 | func (e *executor) buildMSYS2Command(displayCmd *string) *exec.Cmd { |
| 71 | var args []string |
| 72 | if e.msvcEnvs != "" { |
| 73 | args = append(args, e.msvcEnvs) |
| 74 | } |
| 75 | args = append(args, e.command) |
| 76 | if len(e.args) > 0 { |
| 77 | args = append(args, e.args...) |
| 78 | } |
| 79 | *displayCmd = strings.Join(args, " ") |
| 80 | |
| 81 | cmd := exec.Command("bash", "-lc", strings.Join(args, " ")) |
| 82 | |
| 83 | // Configure MSYS2 environment variables. |
| 84 | cmd.Env = append(os.Environ(), |
| 85 | "MSYSTEM=MINGW64", // Use MinGW64 subsystem |
| 86 | "CHERE_INVOKING=1", // Disable directory changing |
| 87 | "MSYS=winsymlinks:nativestrict", // Use native Windows symlinks |
| 88 | ) |
| 89 | |
| 90 | return cmd |
| 91 | } |
| 92 | |
| 93 | // buildNativeCommand constructs a command to run in native Windows environment. |
| 94 | func (e *executor) buildNativeCommand(displayCmd *string) *exec.Cmd { |