mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 01:14:22 +00:00
Fix cmd/config windows issues
This commit is contained in:
@@ -194,9 +194,12 @@ func (c *Filter) getCommand() (string, []string) {
|
||||
|
||||
// export the local environment vars to the container
|
||||
for _, pair := range os.Environ() {
|
||||
args = append(args, "-e", strings.Split(pair, "=")[0])
|
||||
items := strings.Split(pair, "=")
|
||||
if items[0] == "" || items[1] == "" {
|
||||
continue
|
||||
}
|
||||
args = append(args, "-e", items[0])
|
||||
}
|
||||
a := append(args, c.Image)
|
||||
|
||||
return "docker", a
|
||||
}
|
||||
|
||||
@@ -103,7 +103,11 @@ metadata:
|
||||
// configure expected env
|
||||
for _, e := range os.Environ() {
|
||||
// the process env
|
||||
tt.expectedArgs = append(tt.expectedArgs, "-e", strings.Split(e, "=")[0])
|
||||
parts := strings.Split(e, "=")
|
||||
if parts[0] == "" || parts[1] == "" {
|
||||
continue
|
||||
}
|
||||
tt.expectedArgs = append(tt.expectedArgs, "-e", parts[0])
|
||||
}
|
||||
tt.expectedArgs = append(tt.expectedArgs, tt.instance.Image)
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ package exec
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
||||
"sigs.k8s.io/kustomize/kyaml/fn/runtime/runtimeutil"
|
||||
@@ -30,5 +31,6 @@ func (c *Filter) Run(reader io.Reader, writer io.Writer) error {
|
||||
cmd := exec.Command(c.Path, c.Args...)
|
||||
cmd.Stdin = reader
|
||||
cmd.Stdout = writer
|
||||
cmd.Stderr = os.Stderr
|
||||
return cmd.Run()
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ package runtimeutil
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"sigs.k8s.io/kustomize/kyaml/yaml"
|
||||
@@ -121,7 +122,10 @@ func getFunctionSpecFromAnnotation(n *yaml.RNode, meta yaml.ResourceMeta) *Funct
|
||||
for _, s := range functionAnnotationKeys {
|
||||
fn := meta.Annotations[s]
|
||||
if fn != "" {
|
||||
_ = yaml.Unmarshal([]byte(fn), &fs)
|
||||
err := yaml.Unmarshal([]byte(fn), &fs)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||
}
|
||||
return &fs
|
||||
}
|
||||
}
|
||||
@@ -131,9 +135,12 @@ func getFunctionSpecFromAnnotation(n *yaml.RNode, meta yaml.ResourceMeta) *Funct
|
||||
}
|
||||
s, err := n.String()
|
||||
if err != nil {
|
||||
return nil
|
||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||
}
|
||||
err = yaml.Unmarshal([]byte(s), &fs)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||
}
|
||||
_ = yaml.Unmarshal([]byte(s), &fs)
|
||||
return &fs
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user