Ensure that errors are logged

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2022-09-19 15:21:57 +02:00
parent 5885fead8f
commit 2b08a79206

View File

@ -48,7 +48,12 @@ func run(argv []string) (rerr error) {
if err != nil { if err != nil {
return fmt.Errorf("failed to set up logger: %v", err) 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) logger.Debugf("Command line arguments: %v", argv)
runtime, err := newNVIDIAContainerRuntime(logger.Logger, cfg, argv) runtime, err := newNVIDIAContainerRuntime(logger.Logger, cfg, argv)