daemon install on Windows: visible console window for the lifetime of the daemon
Summary
On Windows, cc-connect daemon install registers a scheduled task that opens a visible console window. The window remains on screen for the entire lifetime of the daemon. The registered task action already passes -WindowStyle Hidden.
Environment
| OS | Windows 11 Pro 10.0.26200 (build 26200), AMD64 |
| cc-connect | v1.5.0 |
| Install method | cc-connect daemon install --config <path to config.toml> |
Steps to reproduce
- Run
cc-connect daemon install --config <path to config.toml> - Log off and log back in, or run
cc-connect daemon start - A console window appears
Actual behavior
A console window opens and stays open while the daemon runs. Its entire content is a single line:
log: redirecting to C:\Users\<user>\.cc-connect\logs\cc-connect.log with max_size=10485760 bytes (source: env), max_backups=3 (source: env)All other output is written to the log file. The window is not the one started by the scheduled task's powershell.exe; that process runs with -WindowStyle Hidden.
The registered task action is:
powershell.exe -WindowStyle Hidden -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "C:\Users\<user>\.cc-connect\cc-connect-daemon.ps1"The generated launcher starts the binary through the call operator:
while ($true) {
& 'C:\Users\<user>\AppData\Roaming\npm\node_modules\cc-connect\bin\cc-connect.exe'
$exitCode = $LASTEXITCODE
if ($exitCode -eq 0) { exit 0 }
Start-Sleep -Seconds 10
}cc-connect.exe is a console-subsystem executable (PE header Subsystem = 3, IMAGE_SUBSYSTEM_WINDOWS_CUI).
Closing the window terminates the launcher process. The launcher then exits, which ends the scheduled task, and cc-connect daemon start is required in order to run the daemon again.
Expected behavior
No console window is visible while the daemon is running.
Notes on scope
The behavior was reproduced on Windows only. The Register-ScheduledTask invocation in daemon/windows.go does not pass -Settings:
Register-ScheduledTask -TaskName %s -Action $action -Trigger $trigger -Principal $principal -Force | Out-NullThis is identical in v1.5.0 and in refs/pull/1896.
Source: chenhg5/cc-connect