From 2ec78bfcfc55645d99626a10793acab6c42dc2d0 Mon Sep 17 00:00:00 2001 From: Clayton Craft Date: Fri, 18 Aug 2023 17:17:28 -0700 Subject: [PATCH] mkinitfs: print error when failure to rm tmp dir, and make it non-fatal (MR 40) This prints the error when the work dir can't be removed. This also changes mkinitfs so that it does't fail in this situation. The reasoning for this change in behavior is that mkinitfs returning non-zero will signal to the caller that there's potentially a problem with configuring boot-related stuff on their system, and a failure to rm the work dir is just noise. If the cause of that failure is a deeper problem, the log message should help figure it out. fixes #35 --- cmd/mkinitfs/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/mkinitfs/main.go b/cmd/mkinitfs/main.go index 08b9e58..ea8f676 100644 --- a/cmd/mkinitfs/main.go +++ b/cmd/mkinitfs/main.go @@ -80,8 +80,8 @@ func main() { defer func() { e := os.RemoveAll(workDir) if e != nil && err == nil { - err = e - retCode = 1 + log.Println(e) + log.Println("unable to remove temporary work directory") } }()