Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Replace pathwatcher w/ bundled watcher to catch created & rename events #15440
This PR addresses three issues related to config settings data loss.
config file stops being watched
Repro steps (on MacOS):
Turns out that after step 3 we stop watching the
The fix implemented in this PR involves using @smashwilson's new bundled file watching service. We reload the user's config on
The bug outlined above resulted in the config file reverting to a previous version of the file prior to being overwritten. It seems that most of the reports in #14909 indicate that the config file was reset completely, which points to a root cause other than what was outlined above.
The rest of this PR aims to make the code around writing to the config file more airtight. There are only two places where we make calls to
race condition in
Previously, there was room for a race condition. An external process could have created a config file after we checked for its existence and before we wrote to the file, potentially resulting in overwriting the changes made by an external process.
Solution: Don't write file if it already exists (depends on atom/season#22)
race condition in
Previously, there was the possibility that this happened before the in-memory settings were updated to reflect the user's config on disk (
Solution: Store of
I've made a slight change here. When we store pending operations that happen before the first call to
atom.config.set('foo.bar', 10) atom.config.get('foo.bar') // => undefined
Instead, what I've done is store the pending operation in a closure and allow it to proceed (without triggering a