fix(list): prevent nil pointer panic in watch mode with daemon (#1324)
When running `bd list -w` with the daemon active, watchIssues() was called with nil store, causing a panic at store.SearchIssues(). In daemon mode, storage operations are handled via RPC, so the global `store` variable is nil. The watch mode code path didn't account for this and used `store` directly. Fix: Call ensureDirectMode() before watchIssues() to initialize the store. This follows the same pattern used for other commands that need direct store access in daemon mode (e.g., graph, ship). Fixes #1323 Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1020,7 +1020,12 @@ var listCmd = &cobra.Command{
|
||||
sortIssues(issues, sortBy, reverse)
|
||||
|
||||
// Handle watch mode (GH#654)
|
||||
// Watch mode requires direct store access for file watching
|
||||
if watchMode {
|
||||
if err := ensureDirectMode("watch mode requires direct database access"); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
watchIssues(ctx, store, filter, sortBy, reverse)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user