Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
flowctl: atomically persist config files
We've observed an infrequent but _super_ annoying bug where flowctl can occasionally truncate its own config file. This seems to be related to concurrent invocations of flowctl, where one instance will observe the truncated config file as it's being overwritten by another instance. In some scenarios, we've also observed the config file being left in a truncated state. This commit updates the `Config::write` function to write the config to a temp file, which is subsequently renamed to the target config file. This guarantees that another instance will either see the first version of the config file, or the new one, but never anything in between.
- Loading branch information