Fix/version comparison - #54
Open
ktjysu wants to merge 2 commits into
Open
Conversation
- Add get_gateway_port() function to read gateway.port from openclaw.json - Replace hardcoded port 18789 with dynamic port in: - shell.rs: spawn_openclaw_gateway() - service.rs: service status/start/stop - config.rs: get_dashboard_url() - process.rs: check_port_in_use() - diagnostics.rs: security checks Closes miaoxworld#51
- Add regex to extract version number from full output (format: 202X.XX.XX) - Support various output formats: "OpenClaw 2026.3.24 (cff6dc9)", "2026.3.24", "v2026.3.24" - Fix version comparison logic when versions are identical but full output differs - Add regex dependency
Author
|
这个实际可以解决 #46 提出的错误提示 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题描述
当 openclaw --version 返回完整输出时(如 "OpenClaw 2026.3.24 (cff6dc9)"),版本比较逻辑会错误地认为有更新可用,即使当前版本已经是最新版本。
根本原因
openclaw --version返回的完整格式包含前缀和 git commit hash:OpenClaw 2026.3.24 (cff6dc9)
原来的版本比较逻辑直接使用这个完整字符串,按
.分割后得到:"OpenClaw 2026", "3", "24 (cff6dc9)"
第一部分
OpenClaw 2026无法解析为数字,导致比较逻辑失效。解决方案
修改
get_openclaw_version()函数,使用正则表达式从完整输出中提取纯版本号: