fix(config): use r+ when fsyncing migrated temp file
Apply the Windows-safe open mode in migrateLegacyPluginEntry and add a regression test to assert the temp fd is opened with r+ before fsync. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -54,7 +54,7 @@ export function migrateLegacyPluginEntry(configPath: string): boolean {
|
||||
|
||||
const tempPath = `${configPath}.tmp`
|
||||
writeFileSync(tempPath, updated, "utf-8")
|
||||
const tempFileDescriptor = openSync(tempPath, "r")
|
||||
const tempFileDescriptor = openSync(tempPath, "r+")
|
||||
try {
|
||||
fsyncSync(tempFileDescriptor)
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user