增加注册系统服务时的输出内容

This commit is contained in:
lwch
2022-09-06 14:48:44 +08:00
parent 6771d73816
commit 41cffb5c65
3 changed files with 8 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ package agent
import (
"context"
"fmt"
"github.com/jkstack/anet"
"github.com/jkstack/libagent/conf"
@@ -45,6 +46,8 @@ func deferCallback(name string, fn func()) {
// RegisterService 注册系统服务
func RegisterService(app App) error {
svc := newService(app)
fmt.Printf("service name: %s\n", app.AgentName())
fmt.Printf("platform: %s\n", svc.Platform())
return svc.Install()
}

View File

@@ -5,4 +5,5 @@ type builtinService interface {
Uninstall() error
Run() error
Stop() error
Platform() string
}

View File

@@ -133,3 +133,7 @@ func (svr *svr) Execute(args []string, r <-chan svc.ChangeRequest, changes chan<
changes <- svc.Status{State: svc.StopPending}
return false, 0
}
func (svr *svr) Platform() string {
return "windows-service"
}