diff options
-rw-r--r-- | buildstream/_yaml.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/buildstream/_yaml.py b/buildstream/_yaml.py index 8e51050c3..7bb9b7867 100644 --- a/buildstream/_yaml.py +++ b/buildstream/_yaml.py @@ -26,6 +26,7 @@ from contextlib import ExitStack from ruamel import yaml from ruamel.yaml.representer import SafeRepresenter, RoundTripRepresenter from ._exceptions import LoadError, LoadErrorReason +from . import utils # We store information in the loaded yaml on a DictProvenance @@ -213,7 +214,7 @@ def load_data(data, shortname=None, copy_tree=False): def dump(node, filename=None): with ExitStack() as stack: if filename: - f = stack.enter_context(open(filename, 'w')) + f = stack.enter_context(utils.save_file_atomic(filename, 'w')) else: f = sys.stdout yaml.round_trip_dump(node, f) |