mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-21 12:59:04 +00:00
gdb: kill openocd if it does not exit
This commit is contained in:
@@ -15,6 +15,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync/atomic"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -464,8 +465,15 @@ func FlashGDB(pkgName string, ocdOutput bool, options *compileopts.Options) erro
|
|||||||
}
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
daemon.Process.Signal(os.Interrupt)
|
daemon.Process.Signal(os.Interrupt)
|
||||||
// Maybe we should send a .Kill() after x seconds?
|
var stopped uint32
|
||||||
|
go func() {
|
||||||
|
time.Sleep(time.Millisecond * 100)
|
||||||
|
if atomic.LoadUint32(&stopped) == 0 {
|
||||||
|
daemon.Process.Kill()
|
||||||
|
}
|
||||||
|
}()
|
||||||
daemon.Wait()
|
daemon.Wait()
|
||||||
|
atomic.StoreUint32(&stopped, 1)
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user