Add background mode support to localagent and implement instance check

This commit is contained in:
2026-08-18 17:03:20 +03:00
parent fe77f17ac9
commit 15f7fd91ab
3 changed files with 78 additions and 2 deletions
+16 -2
View File
@@ -4,16 +4,30 @@
//
// GOOS=windows GOARCH=amd64 go build -ldflags "-s -w" -o localagent.exe .
//
// The binary is a normal console application. A CMD window appears on launch
// and prints the listen address. Press Ctrl+C to stop.
// A CMD window appears on launch. Use -background to start without a window:
//
// localagent.exe -background
package main
import (
"flag"
"tea.chunkbyte.com/kato/go-worm/lib/agent"
"tea.chunkbyte.com/kato/go-worm/lib/helpers"
"tea.chunkbyte.com/kato/go-worm/lib/instance"
)
func main() {
background := flag.Bool("background", false, "run without a console window")
flag.Parse()
if *background {
if err := instance.Detach(); err != nil {
helpers.Log.Fatalf("%v", err)
}
return
}
a, err := agent.New()
if err != nil {
helpers.Log.Fatalf("%v", err)