-
Notifications
You must be signed in to change notification settings - Fork 82
Open
Description
Summary
The preview command (and potentially interactive command) launches an interactive REPL console that requires a valid console handle. This prevents running the preview server in non-interactive contexts such as:
- CI/CD pipelines
- Background processes
- IDE integrations (e.g., Claude Code, VS Code tasks)
- Containerized environments
- Any automated tooling
Current Behavior
When running dotnet run -- preview, the server starts successfully but then fails with:
[INFO] Preview server listening at http://localhost:5080
[INFO] Type Ctrl-C or "Exit()" to exit and "Help()" for global methods and properties
> Error: The handle is invalid.
This happens because the REPL attempts to interact with stdin/stdout handles that aren't available in non-interactive contexts.
Proposed Solution
Add a CLI flag such as --no-interactive or --headless to disable the REPL while keeping the preview server running:
dotnet run -- preview --no-interactiveThis would allow the preview server to run in daemon/background mode without requiring console interaction.
Alternatives Considered
- Using
servecommand separately (requires two-step build then serve) - Spawning in a new terminal window (platform-specific workaround)
- Piping empty stdin (doesn't reliably work)
Environment
- Statiq.Web 1.0.0
- .NET 8.0
- Windows 11 (but issue likely affects all platforms in non-interactive contexts)
Metadata
Metadata
Assignees
Labels
No labels