mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-08-10 13:20:33 +02: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:
+7
-1
@@ -222,10 +222,16 @@ func run(appCallback *AppCallback, stopCh chan struct{}) {
|
|||||||
lc := &logConn{conn: conn}
|
lc := &logConn{conn: conn}
|
||||||
consoleWriter.Out = io.MultiWriter(os.Stdout, lc)
|
consoleWriter.Out = io.MultiWriter(os.Stdout, lc)
|
||||||
p.logConn = 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() {
|
notifyExitToLogServer := func() {
|
||||||
_, _ = p.logConn.Write([]byte(msgExit))
|
if p.logConn != nil {
|
||||||
|
_, _ = p.logConn.Write([]byte(msgExit))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if daemon && runtime.GOOS == "windows" {
|
if daemon && runtime.GOOS == "windows" {
|
||||||
|
|||||||
Reference in New Issue
Block a user