File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -175,7 +175,16 @@ impl Client<StdioTransport> {
175175 command. args ( args) . spawn ( ) ?
176176 } ;
177177 let server_process_id = child. id ( ) . ok_or ( ClientError :: MissingProcessId ) ?;
178- let server_process_id = Pid :: from_raw ( server_process_id. try_into ( ) . unwrap ( ) ) ;
178+
179+ #[ cfg( windows) ]
180+ let server_process_id = Pid :: from_raw ( server_process_id) ; // On Windows, child.id() returns u32 which matches Pid::from_raw
181+ #[ cfg( not( windows) ) ]
182+ let server_process_id = Pid :: from_raw (
183+ server_process_id
184+ . try_into ( )
185+ . map_err ( |_err| ClientError :: MissingProcessId ) ?,
186+ ) ; // On Unix, safely convert u32 to i32
187+
179188 let server_process_id = Some ( server_process_id) ;
180189 let transport = Arc :: new ( transport:: stdio:: JsonRpcStdioTransport :: client ( child) ?) ;
181190 Ok ( Self {
You can’t perform that action at this time.
0 commit comments