// parseStringEnv parse the package Env string and converts it into an // environment slice. func parseStringEnv(s string) []string { env := []string{} if s == "" { return env } s = str.Clean(s) argv := str.ToArgv(s) for _, kv := range argv { if !strings.Contains(kv, "=") { continue } env = append(env, kv) } return env }
func splitCommand(command string) (executable string, argv, env []string) { argv = str.ToArgv(command) for i, item := range argv { if strings.Contains(item, "=") { if env == nil { env = []string{item} continue } env = append(env, item) } else { executable = item argv = argv[i+1:] return } } executable = argv[0] argv = argv[1:] return }