File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,14 +87,13 @@ mod platform {
8787 continue ;
8888 }
8989 let trimmed = line. trim ( ) ;
90- if trimmed. starts_with ( "pid = " ) {
91- if let Ok ( p) = trimmed [ "pid = " . len ( ) .. ] . trim ( ) . parse :: < u32 > ( ) {
90+ if let Some ( rest ) = trimmed. strip_prefix ( "pid = " ) {
91+ if let Ok ( p) = rest . trim ( ) . parse :: < u32 > ( ) {
9292 pid = Some ( p) ;
9393 }
9494 }
95- if trimmed. starts_with ( "state = " ) {
96- let state = trimmed[ "state = " . len ( ) ..] . trim ( ) ;
97- running = state == "running" ;
95+ if let Some ( rest) = trimmed. strip_prefix ( "state = " ) {
96+ running = rest. trim ( ) == "running" ;
9897 }
9998 }
10099
Original file line number Diff line number Diff line change 11#[ cfg( target_os = "windows" ) ]
22use std:: os:: windows:: process:: CommandExt ;
3- use std:: process:: Command ;
43
54/// 跨平台获取 openclaw 命令的方法(同步版本)
65/// 在 Windows 上使用 `cmd /c openclaw` 以兼容全局 npm 路径下的 `.cmd` 脚本
7- pub fn openclaw_command ( ) -> Command {
6+ #[ allow( dead_code) ]
7+ pub fn openclaw_command ( ) -> std:: process:: Command {
88 #[ cfg( target_os = "windows" ) ]
99 {
1010 const CREATE_NO_WINDOW : u32 = 0x08000000 ;
11- let mut cmd = Command :: new ( "cmd" ) ;
11+ let mut cmd = std :: process :: Command :: new ( "cmd" ) ;
1212 cmd. arg ( "/c" ) . arg ( "openclaw" ) ;
1313 cmd. creation_flags ( CREATE_NO_WINDOW ) ;
1414 cmd
1515 }
1616 #[ cfg( not( target_os = "windows" ) ) ]
1717 {
18- Command :: new ( "openclaw" )
18+ std :: process :: Command :: new ( "openclaw" )
1919 }
2020}
2121
You can’t perform that action at this time.
0 commit comments