From 2b08a79206fafd773614a4031f6ca5dcddfff750 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Mon, 19 Sep 2022 15:21:57 +0200 Subject: [PATCH] Ensure that errors are logged Signed-off-by: Evan Lezar --- cmd/nvidia-container-runtime/main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/nvidia-container-runtime/main.go b/cmd/nvidia-container-runtime/main.go index ea935aca..9859d910 100644 --- a/cmd/nvidia-container-runtime/main.go +++ b/cmd/nvidia-container-runtime/main.go @@ -48,7 +48,12 @@ func run(argv []string) (rerr error) { if err != nil { return fmt.Errorf("failed to set up logger: %v", err) } - defer logger.Reset() + defer func() { + if rerr != nil { + logger.Errorf("%v", rerr) + } + logger.Reset() + }() logger.Debugf("Command line arguments: %v", argv) runtime, err := newNVIDIAContainerRuntime(logger.Logger, cfg, argv)