File tree 1 file changed +10
-1
lines changed 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -175,7 +175,16 @@ impl Client<StdioTransport> {
175
175
command. args ( args) . spawn ( ) ?
176
176
} ;
177
177
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
+
179
188
let server_process_id = Some ( server_process_id) ;
180
189
let transport = Arc :: new ( transport:: stdio:: JsonRpcStdioTransport :: client ( child) ?) ;
181
190
Ok ( Self {
You can’t perform that action at this time.
0 commit comments