Skip to content

Commit fe7ab10

Browse files
committed
Fix env command
1 parent ed54c47 commit fe7ab10

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cmd/build-naive/cmd_env.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func printEnv(t Target) {
8787
if t.ARCH == "386" || t.ARCH == "arm" {
8888
ldFlags = append(ldFlags, "-no-pie")
8989
}
90-
fmt.Printf("%sCGO_LDFLAGS=%s\n", prefix, shellQuote(strings.Join(ldFlags, " ")))
90+
fmt.Printf("%sCGO_LDFLAGS=%s\n", prefix, shellQuote(strings.Join(ldFlags, " "), envExport))
9191
}
9292
// Darwin/iOS: No CGO_LDFLAGS needed, all flags are in the generated cgo files
9393

@@ -100,14 +100,14 @@ func printEnv(t Target) {
100100
cc := fmt.Sprintf("%s --target=%s --sysroot=%s", clangPath, clangTarget, sysroot)
101101
cxx := fmt.Sprintf("%s++ --target=%s --sysroot=%s", clangPath, clangTarget, sysroot)
102102

103-
fmt.Printf("%sCC=%s\n", prefix, shellQuote(cc))
104-
fmt.Printf("%sCXX=%s\n", prefix, shellQuote(cxx))
103+
fmt.Printf("%sCC=%s\n", prefix, shellQuote(cc, envExport))
104+
fmt.Printf("%sCXX=%s\n", prefix, shellQuote(cxx, envExport))
105105
fmt.Printf("%sQEMU_LD_PREFIX=%s\n", prefix, sysroot)
106106
}
107107
}
108108

109-
func shellQuote(s string) string {
110-
if strings.ContainsAny(s, " \t\n\"'\\$") {
109+
func shellQuote(s string, quote bool) string {
110+
if quote && strings.ContainsAny(s, " \t\n\"'\\$") {
111111
return "\"" + strings.ReplaceAll(s, "\"", "\\\"") + "\""
112112
}
113113
return s

0 commit comments

Comments
 (0)