mirror of
https://github.com/lxc/incus
synced 2026-08-02 05:26:46 +00:00
lxc-to-incus: Log deferred errors with WarnOnError
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
This commit is contained in:
parent
0c41c18ab2
commit
ecd9e93885
@ -9,6 +9,7 @@ import (
|
||||
"strings"
|
||||
|
||||
internalUtil "github.com/lxc/incus/v7/internal/util"
|
||||
"github.com/lxc/incus/v7/shared/logger"
|
||||
"github.com/lxc/incus/v7/shared/util"
|
||||
)
|
||||
|
||||
@ -130,7 +131,7 @@ func parseConfig(path string) ([]string, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
defer func() { _ = file.Close() }()
|
||||
defer logger.WarnOnError(file.Close, "Failed to close file")
|
||||
|
||||
var config []string
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/lxc/incus/v7/internal/eagain"
|
||||
"github.com/lxc/incus/v7/shared/logger"
|
||||
"github.com/lxc/incus/v7/shared/util"
|
||||
)
|
||||
|
||||
@ -56,7 +57,7 @@ func (c *cmdNetcat) run(cmd *cobra.Command, args []string) error {
|
||||
wg.Add(1)
|
||||
|
||||
go func() {
|
||||
defer func() { _ = conn.Close() }()
|
||||
defer logger.WarnOnError(conn.Close, "Failed to close connection")
|
||||
defer wg.Done()
|
||||
|
||||
_, _ = util.SafeCopy(eagain.Writer{Writer: os.Stdout}, eagain.Reader{Reader: conn})
|
||||
|
||||
@ -13,6 +13,7 @@ import (
|
||||
|
||||
"github.com/lxc/incus/v7/internal/linux"
|
||||
"github.com/lxc/incus/v7/internal/migration"
|
||||
"github.com/lxc/incus/v7/shared/logger"
|
||||
"github.com/lxc/incus/v7/shared/ws"
|
||||
)
|
||||
|
||||
@ -24,7 +25,7 @@ func rsyncSend(conn *websocket.Conn, path string, rsyncArgs string) error {
|
||||
}
|
||||
|
||||
if dataSocket != nil {
|
||||
defer func() { _ = dataSocket.Close() }()
|
||||
defer logger.WarnOnError(dataSocket.Close, "Failed to close connection")
|
||||
}
|
||||
|
||||
readDone, writeDone := ws.Mirror(conn, dataSocket)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user