Enable :sync mode when writing to the local file system (#1378)

This ensures we always flush changes right away when saving
a notebook. This is important for Nerves Livebook, where it
is more likely the device is stopped abruptly.
This commit is contained in:
Jonatan Kłosko 2022-09-02 10:28:03 +02:00 committed by GitHub
parent 2024187226
commit e14fbdb616
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -102,7 +102,7 @@ defimpl Livebook.FileSystem, for: Livebook.FileSystem.Local do
with :ok <- ensure_local(file_system) do
with :ok <- File.mkdir_p(dir),
:ok <- File.write(path, content) do
:ok <- File.write(path, content, [:sync]) do
:ok
else
{:error, error} -> FileSystem.Utils.posix_error(error)