From 895d109fc476360be1231d813c233ba01e5a6837 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Sat, 22 Sep 2018 01:40:46 +0200 Subject: [PATCH] compiler: run flash command in a shell --- main.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/main.go b/main.go index 79dd340b..74ec383d 100644 --- a/main.go +++ b/main.go @@ -174,15 +174,11 @@ func Flash(pkgName, target, port string, printIR, dumpSSA bool, printSizes strin return Compile(pkgName, ".hex", spec, printIR, dumpSSA, printSizes, func(tmppath string) error { // Create the command. flashCmd := spec.Flasher - parts := strings.Split(flashCmd, " ") // TODO: this should be a real shell split - for i, part := range parts { - part = strings.Replace(part, "{hex}", tmppath, -1) - part = strings.Replace(part, "{port}", port, -1) - parts[i] = part - } + flashCmd = strings.Replace(flashCmd, "{hex}", tmppath, -1) + flashCmd = strings.Replace(flashCmd, "{port}", port, -1) // Execute the command. - cmd := exec.Command(parts[0], parts[1:]...) + cmd := exec.Command("/bin/sh", "-c", flashCmd) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr return cmd.Run()