Fix bd daemon command syntax and flags (#522)
This commit is contained in:
@@ -124,7 +124,7 @@ func restartBdDaemons() error { //nolint:unparam // error return kept for future
|
|||||||
// StartBdDaemonIfNeeded starts the bd daemon for a specific workspace if not running.
|
// StartBdDaemonIfNeeded starts the bd daemon for a specific workspace if not running.
|
||||||
// This is a best-effort operation - failures are logged but don't block execution.
|
// This is a best-effort operation - failures are logged but don't block execution.
|
||||||
func StartBdDaemonIfNeeded(workDir string) error {
|
func StartBdDaemonIfNeeded(workDir string) error {
|
||||||
cmd := exec.Command("bd", "daemon", "--start")
|
cmd := exec.Command("bd", "daemon", "start")
|
||||||
cmd.Dir = workDir
|
cmd.Dir = workDir
|
||||||
return cmd.Run()
|
return cmd.Run()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -407,7 +407,7 @@ func runStatusOnce(_ *cobra.Command, _ []string) error {
|
|||||||
// Show bd daemon warning at the end if there were issues
|
// Show bd daemon warning at the end if there were issues
|
||||||
if bdWarning != "" {
|
if bdWarning != "" {
|
||||||
fmt.Printf("%s %s\n", style.Warning.Render("⚠"), bdWarning)
|
fmt.Printf("%s %s\n", style.Warning.Render("⚠"), bdWarning)
|
||||||
fmt.Printf(" Run 'bd daemon killall && bd daemon --start' to restart daemons\n")
|
fmt.Printf(" Run 'bd daemon killall && bd daemon start' to restart daemons\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ func NewBdDaemonCheck() *BdDaemonCheck {
|
|||||||
// Run checks if the bd daemon is running and healthy.
|
// Run checks if the bd daemon is running and healthy.
|
||||||
func (c *BdDaemonCheck) Run(ctx *CheckContext) *CheckResult {
|
func (c *BdDaemonCheck) Run(ctx *CheckContext) *CheckResult {
|
||||||
// Check daemon status
|
// Check daemon status
|
||||||
cmd := exec.Command("bd", "daemon", "--status")
|
cmd := exec.Command("bd", "daemon", "status")
|
||||||
cmd.Dir = ctx.TownRoot
|
cmd.Dir = ctx.TownRoot
|
||||||
var stdout, stderr bytes.Buffer
|
var stdout, stderr bytes.Buffer
|
||||||
cmd.Stdout = &stdout
|
cmd.Stdout = &stdout
|
||||||
@@ -41,7 +41,7 @@ func (c *BdDaemonCheck) Run(ctx *CheckContext) *CheckResult {
|
|||||||
// Check if daemon is running
|
// Check if daemon is running
|
||||||
if err == nil && strings.Contains(output, "Daemon is running") {
|
if err == nil && strings.Contains(output, "Daemon is running") {
|
||||||
// Daemon is running, now check health
|
// Daemon is running, now check health
|
||||||
healthCmd := exec.Command("bd", "daemon", "--health")
|
healthCmd := exec.Command("bd", "daemon", "health")
|
||||||
healthCmd.Dir = ctx.TownRoot
|
healthCmd.Dir = ctx.TownRoot
|
||||||
var healthOut bytes.Buffer
|
var healthOut bytes.Buffer
|
||||||
healthCmd.Stdout = &healthOut
|
healthCmd.Stdout = &healthOut
|
||||||
@@ -82,7 +82,7 @@ func (c *BdDaemonCheck) Run(ctx *CheckContext) *CheckResult {
|
|||||||
|
|
||||||
// tryStartDaemon attempts to start the bd daemon and returns any error output.
|
// tryStartDaemon attempts to start the bd daemon and returns any error output.
|
||||||
func (c *BdDaemonCheck) tryStartDaemon(ctx *CheckContext) *startError {
|
func (c *BdDaemonCheck) tryStartDaemon(ctx *CheckContext) *startError {
|
||||||
cmd := exec.Command("bd", "daemon", "--start")
|
cmd := exec.Command("bd", "daemon", "start")
|
||||||
cmd.Dir = ctx.TownRoot
|
cmd.Dir = ctx.TownRoot
|
||||||
var stdout, stderr bytes.Buffer
|
var stdout, stderr bytes.Buffer
|
||||||
cmd.Stdout = &stdout
|
cmd.Stdout = &stdout
|
||||||
@@ -178,7 +178,7 @@ func (c *BdDaemonCheck) parseStartError(err *startError) *CheckResult {
|
|||||||
Status: StatusError,
|
Status: StatusError,
|
||||||
Message: "bd daemon failed to start",
|
Message: "bd daemon failed to start",
|
||||||
Details: details,
|
Details: details,
|
||||||
FixHint: "Check 'bd daemon --status' and logs in .beads/daemon.log",
|
FixHint: "Check 'bd daemon status' and logs in .beads/daemon.log",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,13 +201,13 @@ func (c *BdDaemonCheck) Fix(ctx *CheckContext) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try starting again
|
// Try starting again
|
||||||
startCmd := exec.Command("bd", "daemon", "--start")
|
startCmd := exec.Command("bd", "daemon", "start")
|
||||||
startCmd.Dir = ctx.TownRoot
|
startCmd.Dir = ctx.TownRoot
|
||||||
return startCmd.Run()
|
return startCmd.Run()
|
||||||
}
|
}
|
||||||
|
|
||||||
// For other errors, just try to start
|
// For other errors, just try to start
|
||||||
startCmd := exec.Command("bd", "daemon", "--start")
|
startCmd := exec.Command("bd", "daemon", "start")
|
||||||
startCmd.Dir = ctx.TownRoot
|
startCmd.Dir = ctx.TownRoot
|
||||||
return startCmd.Run()
|
return startCmd.Run()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user