mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-18 19:44:00 +00:00
compiler: run flash command in a shell
This commit is contained in:
@@ -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 {
|
return Compile(pkgName, ".hex", spec, printIR, dumpSSA, printSizes, func(tmppath string) error {
|
||||||
// Create the command.
|
// Create the command.
|
||||||
flashCmd := spec.Flasher
|
flashCmd := spec.Flasher
|
||||||
parts := strings.Split(flashCmd, " ") // TODO: this should be a real shell split
|
flashCmd = strings.Replace(flashCmd, "{hex}", tmppath, -1)
|
||||||
for i, part := range parts {
|
flashCmd = strings.Replace(flashCmd, "{port}", port, -1)
|
||||||
part = strings.Replace(part, "{hex}", tmppath, -1)
|
|
||||||
part = strings.Replace(part, "{port}", port, -1)
|
|
||||||
parts[i] = part
|
|
||||||
}
|
|
||||||
|
|
||||||
// Execute the command.
|
// Execute the command.
|
||||||
cmd := exec.Command(parts[0], parts[1:]...)
|
cmd := exec.Command("/bin/sh", "-c", flashCmd)
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
return cmd.Run()
|
return cmd.Run()
|
||||||
|
|||||||
Reference in New Issue
Block a user