From: Daan De Meyer Date: Sun, 31 Oct 2021 21:01:28 +0000 (+0000) Subject: Call flush() in a few more places X-Git-Tag: v11~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b09ec85a1f73bbe564deed1e9ea0b16242c0d443;p=thirdparty%2Fmkosi.git Call flush() in a few more places Since we never explicitly close these files, sometimes the stuff we write to them doesn't seem to get flushed which causes the files to be empty in the output directory. Add calls to flush() to make sure the files aren't empty when mkosi finishes. --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index e46f353d0..61a8a4881 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -4132,6 +4132,7 @@ def write_root_hash_file(args: CommandLineArguments, root_hash: Optional[str]) - tempfile.NamedTemporaryFile(mode="w+b", prefix=".mkosi", dir=os.path.dirname(args.output_root_hash_file)), ) f.write((root_hash + "\n").encode()) + f.flush() return f @@ -4151,6 +4152,7 @@ def write_root_hash_p7s_file(args: CommandLineArguments, root_hash_p7s: Optional ), ) f.write(root_hash_p7s) + f.flush() return f @@ -4171,6 +4173,7 @@ def copy_nspawn_settings(args: CommandLineArguments) -> Optional[BinaryIO]: with open(args.nspawn_settings, "rb") as c: f.write(c.read()) + f.flush() return f