main: check for error after starting the OCD daemon
This replaces a panic with an informative error message if the right tool (such as OpenOCD) is not installed.
Этот коммит содержится в:
родитель
e83d1a02b6
коммит
b3d3debd4c
1 изменённых файлов: 12 добавлений и 3 удалений
15
main.go
15
main.go
|
@ -335,7 +335,10 @@ func FlashGDB(pkgName string, ocdOutput bool, options *compileopts.Options) erro
|
|||
// GDB (to break the currently executing program).
|
||||
setCommandAsDaemon(daemon)
|
||||
// Start now, and kill it on exit.
|
||||
daemon.Start()
|
||||
err = daemon.Start()
|
||||
if err != nil {
|
||||
return &commandError{"failed to run", daemon.Path, err}
|
||||
}
|
||||
defer func() {
|
||||
daemon.Process.Signal(os.Interrupt)
|
||||
// Maybe we should send a .Kill() after x seconds?
|
||||
|
@ -360,7 +363,10 @@ func FlashGDB(pkgName string, ocdOutput bool, options *compileopts.Options) erro
|
|||
// GDB (to break the currently executing program).
|
||||
setCommandAsDaemon(daemon)
|
||||
// Start now, and kill it on exit.
|
||||
daemon.Start()
|
||||
err = daemon.Start()
|
||||
if err != nil {
|
||||
return &commandError{"failed to run", daemon.Path, err}
|
||||
}
|
||||
defer func() {
|
||||
daemon.Process.Signal(os.Interrupt)
|
||||
// Maybe we should send a .Kill() after x seconds?
|
||||
|
@ -380,7 +386,10 @@ func FlashGDB(pkgName string, ocdOutput bool, options *compileopts.Options) erro
|
|||
setCommandAsDaemon(daemon)
|
||||
|
||||
// Start now, and kill it on exit.
|
||||
daemon.Start()
|
||||
err = daemon.Start()
|
||||
if err != nil {
|
||||
return &commandError{"failed to run", daemon.Path, err}
|
||||
}
|
||||
defer func() {
|
||||
daemon.Process.Signal(os.Interrupt)
|
||||
// Maybe we should send a .Kill() after x seconds?
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче