compiler: run flash command in a shell
Этот коммит содержится в:
родитель
7517ac86e4
коммит
895d109fc4
1 изменённых файлов: 3 добавлений и 7 удалений
10
main.go
10
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 {
|
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()
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче