MCPcopy Create free account
hub / github.com/celer-pkg/celer / buildMSYS2Command

Method buildMSYS2Command

pkgs/cmd/exec_windows.go:70–91  ·  view source on GitHub ↗

buildMSYS2Command constructs a command to run in MSYS2/bash environment.

(displayCmd *string)

Source from the content-addressed store, hash-verified

68
69// buildMSYS2Command constructs a command to run in MSYS2/bash environment.
70func (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.
94func (e *executor) buildNativeCommand(displayCmd *string) *exec.Cmd {

Calls 1

CommandMethod · 0.65