You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(service): add Windows service wrapper and graceful single-process deployment #73
Activity
version(1.10.0-dev): 开发线起点 + v1.10.0 发布准备
feat(service,webapp): Windows 服务封装 + 跨进程 WS 广播桥(#73 / #74)
Antruly commentedon Nov 23, 2026
已实现并合入
master(1.11.0-dev,ce81ff8上五条 CI 全绿)。Windows 的 SCM 安装/启停本身还没有在真 Windows 上实跑过 —— CI 只覆盖编译,所以这条先留着等实机验证。API:
src/webapp/uvcpp_service.h子命令:
run [--foreground]/install/uninstall/start/stop/status(缺省run)。选项:--name、--display-name、--description、--config、--log、--log-max-mb、--log-files、--workdir、--env K=V、--grace-ms、--foreground、--no-single-instance。已落地:
CreateServiceW(自动启动)、ChangeServiceConfig2W配描述与SC_ACTION_RESTART(5 秒 ×3,一天复位)、STOP/SHUTDOWN →app.stop()+join();非 SCM 启动自动落回前台模式。x.log→.1…)。flock,冲突返回UV_EBUSY并明确报错。SERVICE_ACCEPT_PAUSE_CONTINUE);POSIX 上install等返回UV_ENOTSUP,交给 systemd/launchd。验证:
test_web_app_service_func(POSIX)覆盖信号停机退出码 0、在途请求在 SIGTERM 后仍拿到完整 body、同名第二实例退出非 0、日志落盘并轮转、子命令错误码。Windows 分支用 MinGW-fsyntax-only交叉检查;真正的 SCM 安装/停止请在 Windows 机器上跑app install,再用sc start/sc stop验证,通过后即可关闭。Antruly commentedon Nov 23, 2026
SCM 的真机验证补上了,并且是自动化的:新用例
test_web_app_service_scm_func在 CI 的 MSVCweb格里真跑(runner 是管理员),CI 日志:它做的事正好覆盖本 issue 的验收:
install→ SCMstart→ 服务进程写出真实端口、父进程访问/hello→TerminateProcess模拟崩溃 → 等 SCM 按SC_ACTION_RESTART拉起(pid 变化、新实例再次可访问)→stop后服务进程走完优雅停机并写出标记 →uninstall之后status打不到它。开关是 CMake 选项
UVCPP_TEST_SERVICE_SCM(默认 OFF,只在这一格打开);没有管理员权限的机器上用例退 3(SKIP),不会伪装成通过。结合之前的 POSIX 前台用例(信号停机、在途请求排空、单实例、日志轮转),本 issue 的验收全部有自动化覆盖。关闭。