Skip to content
This repository has been archived by the owner on May 14, 2022. It is now read-only.

Commit

Permalink
chore: add StackHeadRpcRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
saitho committed Sep 26, 2021
1 parent b22f153 commit 6134f38
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion stackhead.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ const (
IntCmdUninstallPkgApk string = "stackhead:uninstall:package:apk"
)

type StackHeadRpcRequest struct {
Command string
Data interface{}
}

func ExecCmd(command string, args ...interface{}) error {
c := &gorpc.Client{Addr: "localhost:1412"}
c.Start()
defer c.Stop()
// All client methods issuing RPCs are thread-safe and goroutine-safe,
// i.e. it is safe to call them from multiple concurrently running goroutines.
_, err := c.Call(command, args...)
_, err := c.Call(StackHeadRpcRequest{Command: command, Data: args})
return err
}

0 comments on commit 6134f38

Please sign in to comment.