Skip to content

Fix process management commands on Windows (stop/status/restart)#75

Open
Alexander-He wants to merge 1 commit into
fastclaw-ai:mainfrom
Alexander-He:fix/windows-process-management
Open

Fix process management commands on Windows (stop/status/restart)#75
Alexander-He wants to merge 1 commit into
fastclaw-ai:mainfrom
Alexander-He:fix/windows-process-management

Conversation

@Alexander-He
Copy link
Copy Markdown

Problem

weclaw stop, weclaw status, and weclaw restart are broken on Windows. The functions processExists() and stopAllWeclaw() in cmd/start.go use Unix-only APIs (syscall.Signal(0), syscall.SIGTERM, pkill) with no platform-specific handling.

  • processExists() uses p.Signal(syscall.Signal(0)) — on Windows, os.FindProcess always succeeds and signal 0 is not supported, so this always returns wrong results
  • stopAllWeclaw() uses SIGTERM and pkill — neither works on Windows
  • restart duplicates the same broken logic inline

Changes

  1. Move processExists() and stopAllWeclaw() out of cmd/start.go into platform-specific files with build tags
  2. cmd/proc_unix.go (//go:build !windows) — unchanged Unix implementation
  3. cmd/proc_windows.go (//go:build windows) — Windows implementation using tasklist/taskkill
  4. cmd/restart.go — delegate to stopAllWeclaw() instead of duplicating logic

Testing

Verified on Windows 11: weclaw status now correctly reports the running PID, weclaw stop actually terminates the process, and weclaw restart works end-to-end.

Closes #74

stop, status, and restart commands were broken on Windows because
processExists() and stopAllWeclaw() used Unix-only APIs (syscall.Signal(0),
syscall.SIGTERM, pkill) without platform build tags.

- Move processExists() and stopAllWeclaw() to platform-specific files
- proc_unix.go: same Unix implementation (//go:build !windows)
- proc_windows.go: use tasklist/taskkill instead of signals/pkill
- restart.go: delegate to stopAllWeclaw() instead of duplicating logic

Fixes fastclaw-ai#74
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: stop/status/restart commands broken due to Unix-only process management

1 participant