mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-10 14:03:39 +00:00
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.
This commit is contained in:
committed by
Daniel Esteban
parent
e83d1a02b6
commit
b3d3debd4c
@@ -335,7 +335,10 @@ func FlashGDB(pkgName string, ocdOutput bool, options *compileopts.Options) erro
|
|||||||
// GDB (to break the currently executing program).
|
// GDB (to break the currently executing program).
|
||||||
setCommandAsDaemon(daemon)
|
setCommandAsDaemon(daemon)
|
||||||
// Start now, and kill it on exit.
|
// 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() {
|
defer func() {
|
||||||
daemon.Process.Signal(os.Interrupt)
|
daemon.Process.Signal(os.Interrupt)
|
||||||
// Maybe we should send a .Kill() after x seconds?
|
// 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).
|
// GDB (to break the currently executing program).
|
||||||
setCommandAsDaemon(daemon)
|
setCommandAsDaemon(daemon)
|
||||||
// Start now, and kill it on exit.
|
// 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() {
|
defer func() {
|
||||||
daemon.Process.Signal(os.Interrupt)
|
daemon.Process.Signal(os.Interrupt)
|
||||||
// Maybe we should send a .Kill() after x seconds?
|
// 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)
|
setCommandAsDaemon(daemon)
|
||||||
|
|
||||||
// Start now, and kill it on exit.
|
// 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() {
|
defer func() {
|
||||||
daemon.Process.Signal(os.Interrupt)
|
daemon.Process.Signal(os.Interrupt)
|
||||||
// Maybe we should send a .Kill() after x seconds?
|
// Maybe we should send a .Kill() after x seconds?
|
||||||
|
|||||||
Reference in New Issue
Block a user