diff --git a/cmd/crane/cmd/push.go b/cmd/crane/cmd/push.go index cfd9f98b1..05eedf16f 100644 --- a/cmd/crane/cmd/push.go +++ b/cmd/crane/cmd/push.go @@ -71,7 +71,9 @@ func NewCmdPush(options *[]crane.Option) *cobra.Command { digest := ref.Context().Digest(h.String()) if imageRefs != "" { - return os.WriteFile(imageRefs, []byte(digest.String()), 0600) + if err := os.WriteFile(imageRefs, []byte(digest.String()), 0600); err != nil { + return fmt.Errorf("failed to write image refs to %s: %w", imageRefs, err) + } } // Print the digest of the pushed image to stdout to facilitate command composition.