From c4edc6f5da98fd63a4b55572e46b7df20e32635d Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 31 Jan 2014 15:58:14 +0100 Subject: [PATCH] Make sure to save config on crash --- qutebrowser/app.py | 1 + qutebrowser/utils/config.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 25b49245e..2c979f18d 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -157,6 +157,7 @@ class QuteBrowser(QApplication): argv = [sys.executable] + sys.argv + pages logging.debug('Running {} with args {}'.format(sys.executable, argv)) + config.config.save() sys.stdout.flush() # FIXME this seems broken on Windows, execv() splits on whitespace # in arguments?!? diff --git a/qutebrowser/utils/config.py b/qutebrowser/utils/config.py index bd54c3e4b..eccf9aa42 100644 --- a/qutebrowser/utils/config.py +++ b/qutebrowser/utils/config.py @@ -187,6 +187,8 @@ class Config(ConfigParser): logging.debug("Saving config to {}".format(self.configfile)) with open(self.configfile, 'w') as f: self.write(f) + f.flush() + os.fsync(f.fileno()) def dump_userconfig(self): """Returns the part of the config which was changed by the user as a