Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 01fc2ba

Browse files
committed
Suppress logs about normal closing of RPC plugins on exit.
1 parent 1343053 commit 01fc2ba

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

rpc_plugin.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ import (
1313

1414
// RPCPlugin manages the lifecycle of an external process plugin.
1515
type RPCPlugin struct {
16-
path string
17-
cmd *exec.Cmd
18-
sess *f4rpc.Session
19-
api vfs.HostAPI
16+
path string
17+
cmd *exec.Cmd
18+
sess *f4rpc.Session
19+
api vfs.HostAPI
20+
closing bool
2021
}
2122

2223
func NewRPCPlugin(path string) *RPCPlugin {
@@ -77,7 +78,9 @@ func (p *RPCPlugin) Init(api vfs.HostAPI) error {
7778

7879
go func() {
7980
err := p.sess.Serve()
80-
vtui.DebugLog("RPC Plugin %q exited: %v", p.path, err)
81+
if !p.closing {
82+
vtui.DebugLog("RPC Plugin %q terminated unexpectedly: %v", p.path, err)
83+
}
8184
}()
8285

8386
// Query plugin for its capabilities (drives)
@@ -100,6 +103,7 @@ func (p *RPCPlugin) Init(api vfs.HostAPI) error {
100103
}
101104

102105
func (p *RPCPlugin) Close() error {
106+
p.closing = true
103107
if p.cmd != nil && p.cmd.Process != nil {
104108
p.cmd.Process.Kill()
105109
p.cmd.Wait()

0 commit comments

Comments
 (0)