watch
Enable file watching for a process.
Usage
runix watch <id|name> [flags]
Description
Watches file paths for changes and automatically restarts the process when changes are detected. Uses fsnotify with configurable debounce to batch rapid file changes.
Examples
# Watch the process's cwd (default)
runix watch api
# Watch specific paths
runix watch api --paths ./src --paths ./config
# Custom ignore patterns
runix watch api --ignore "*.test.go" --ignore "_test.go"
# Custom debounce duration
runix watch api --debounce 500ms
Flags
| Flag | Default | Description |
|---|---|---|
--paths | process cwd | Paths to watch (can specify multiple) |
--ignore | (see defaults) | Glob patterns to ignore |
--debounce | 100ms | Debounce window for coalescing changes |
Default Ignore Patterns
When no --ignore flags are provided:
.git
node_modules
__pycache__
*.pyc
.DS_Store
vendor
dist
build
bin
How It Works
- An fsnotify watcher is created for each path (recursively)
- File change events are collected during the debounce window
- After the debounce window, the handler is called with all changed paths
- The handler restarts the process
runix watch api
# [Runix] Watching [./src] for process "api" (Ctrl+C to stop)
# [Runix] File changed: ./src/handler.go
# [Runix] Process "api" restarted
The command blocks until interrupted with Ctrl+C.
Config-Based Watch
Watch can also be configured in runix.yaml:
processes:
api:
entrypoint: ./cmd/api
watch:
paths: ["./src", "./templates"]
ignore: ["*_test.go", "*.md"]
debounce: 200ms
When using runix start api with watch config, the watcher starts automatically.
What's Next
- Watch Mode — How file watching works internally
- Start Command —
--watchflag