mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-02-03 22:18:39 +00:00
cmd/cli: guarding against nil log ipc connection
The log ip connection may be nil, since it was not created if blocked by firewall/VPN apps. While at it, also add warning when the ipc connection could not be created.
This commit is contained in:
committed by
Cuong Manh Le
parent
8db6fa4232
commit
513a6f9ec7
@@ -222,10 +222,16 @@ func run(appCallback *AppCallback, stopCh chan struct{}) {
|
||||
lc := &logConn{conn: conn}
|
||||
consoleWriter.Out = io.MultiWriter(os.Stdout, lc)
|
||||
p.logConn = lc
|
||||
} else {
|
||||
mainLog.Load().Warn().Err(err).Msgf("unable to create log ipc connection")
|
||||
}
|
||||
} else {
|
||||
mainLog.Load().Warn().Err(err).Msgf("unable to resolve socket address: %s", sockPath)
|
||||
}
|
||||
notifyExitToLogServer := func() {
|
||||
_, _ = p.logConn.Write([]byte(msgExit))
|
||||
if p.logConn != nil {
|
||||
_, _ = p.logConn.Write([]byte(msgExit))
|
||||
}
|
||||
}
|
||||
|
||||
if daemon && runtime.GOOS == "windows" {
|
||||
|
||||
Reference in New Issue
Block a user