fix: Auto-export to JSONL now works correctly [fixes #23]
Fixed bug where PersistentPostRun was clearing isDirty flag before calling flushToJSONL(), causing the flush to abort immediately. The fix ensures flushToJSONL() handles the isDirty flag itself, allowing the JSONL export to complete successfully. Also added Arch Linux AUR installation instructions to README. Changes: - cmd/bd/main.go: Fixed PersistentPostRun flush logic - README.md: Added Arch Linux (AUR) installation section - .beads/bd.jsonl: Auto-exported issue bd-169 (init -q flag bug) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -102,11 +102,6 @@ var rootCmd = &cobra.Command{
|
||||
}
|
||||
},
|
||||
PersistentPostRun: func(cmd *cobra.Command, args []string) {
|
||||
// Signal that store is closing (prevents background flush from accessing closed store)
|
||||
storeMutex.Lock()
|
||||
storeActive = false
|
||||
storeMutex.Unlock()
|
||||
|
||||
// Flush any pending changes before closing
|
||||
flushMutex.Lock()
|
||||
needsFlush := isDirty && autoFlushEnabled
|
||||
@@ -116,7 +111,7 @@ var rootCmd = &cobra.Command{
|
||||
flushTimer.Stop()
|
||||
flushTimer = nil
|
||||
}
|
||||
isDirty = false
|
||||
// Don't clear isDirty here - let flushToJSONL do it
|
||||
}
|
||||
flushMutex.Unlock()
|
||||
|
||||
@@ -125,6 +120,11 @@ var rootCmd = &cobra.Command{
|
||||
flushToJSONL()
|
||||
}
|
||||
|
||||
// Signal that store is closing (prevents background flush from accessing closed store)
|
||||
storeMutex.Lock()
|
||||
storeActive = false
|
||||
storeMutex.Unlock()
|
||||
|
||||
if store != nil {
|
||||
_ = store.Close()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user