mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
Avoiding writing ninjalog.cfg unnecessarily
Writing to ninjalog.cfg comes with the risk of failure (Ctrl+C at the wrong time) which can lead to an empty or corrupted file. This will cause errors on subsequent builds when loading the config file, and will lose the users opt-in/out settings. This change ensures that the config file is only written when something has changed, thus essentially avoiding the risk. Bug: 941810 Change-Id: If266f07536569c9ac91ee37c28797c8b2ccc6fdc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1522291 Reviewed-by: Takuto Ikuta <tikuta@chromium.org> Reviewed-by: Fumitoshi Ukai <ukai@chromium.org> Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
This commit is contained in:
@@ -86,8 +86,6 @@ def main():
|
||||
print('ninjalog upload is opted out.')
|
||||
return 0
|
||||
|
||||
SaveConfig(config)
|
||||
|
||||
if 'opt-in' in config and not config['opt-in']:
|
||||
# Upload is opted out.
|
||||
return 0
|
||||
@@ -99,6 +97,8 @@ def main():
|
||||
if config.get("countdown", 0) > 0:
|
||||
# Need to show message.
|
||||
ShowMessage(config["countdown"])
|
||||
# Only save config if something has meaningfully changed.
|
||||
SaveConfig(config)
|
||||
return 0
|
||||
|
||||
if len(sys.argv) == 1:
|
||||
|
||||
Reference in New Issue
Block a user