diff --git a/cmd/sops/common/common.go b/cmd/sops/common/common.go index 7beecb8c1..fa54ecc7d 100644 --- a/cmd/sops/common/common.go +++ b/cmd/sops/common/common.go @@ -321,10 +321,10 @@ func FixAWSKMSEncryptionContextBug(opts GenericDecryptOpts, tree *sops.Tree) (*s } file, err := os.Create(opts.InputPath) - defer file.Close() if err != nil { return nil, NewExitError(fmt.Sprintf("Could not open file for writing: %s", err), codes.CouldNotWriteOutputFile) } + defer file.Close() _, err = file.Write(encryptedFile) if err != nil { return nil, err