mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-21 02:01:35 +00:00
Perform safeRename on writeFileAtomic
This forces a sync of the file as soon as the rename happens to prevent corruption.
This commit is contained in:
parent
c5670ba366
commit
a0ed00d8f3
@ -27,7 +27,7 @@ export async function writeFileAtomic(
|
||||
data: string | Buffer,
|
||||
): Promise<void> {
|
||||
await writeAndSyncFile(`${pathName}.new`, data);
|
||||
await fs.rename(`${pathName}.new`, pathName);
|
||||
await safeRename(`${pathName}.new`, pathName);
|
||||
}
|
||||
|
||||
export async function safeRename(src: string, dest: string): Promise<void> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user