@@ -394,8 +394,11 @@ where
394394 let mut resp = time:: timeout ( Duration :: from_millis ( self . timeout ) , async {
395395 // we want to ignore all other messages sent by the server at this point and let the
396396 // background loop handle them
397+ // We also want to ignore all messages emitted by the server to its stdout that does
398+ // not deserialize into a valid JsonRpcMessage (they are not supposed to do this but
399+ // too many people complained about this so we are adding this safeguard in)
397400 loop {
398- if let JsonRpcMessage :: Response ( resp) = listener. recv ( ) . await ? {
401+ if let Ok ( JsonRpcMessage :: Response ( resp) ) = listener. recv ( ) . await {
399402 if resp. id == id {
400403 break Ok :: < JsonRpcResponse , TransportError > ( resp) ;
401404 }
@@ -461,10 +464,8 @@ where
461464 . await
462465 . map_err ( send_map_err) ??;
463466 let resp = time:: timeout ( Duration :: from_millis ( self . timeout ) , async {
464- // we want to ignore all other messages sent by the server at this point and let the
465- // background loop handle them
466467 loop {
467- if let JsonRpcMessage :: Response ( resp) = listener. recv ( ) . await ? {
468+ if let Ok ( JsonRpcMessage :: Response ( resp) ) = listener. recv ( ) . await {
468469 if resp. id == id {
469470 break Ok :: < JsonRpcResponse , TransportError > ( resp) ;
470471 }
@@ -630,6 +631,8 @@ mod tests {
630631 }
631632
632633 #[ tokio:: test( flavor = "multi_thread" ) ]
634+ // For some reason this test is quite flakey when ran in the CI but not on developer's
635+ // machines. As a result it is hard to debug, hence we are ignoring it for now.
633636 #[ ignore]
634637 async fn test_client_stdio ( ) {
635638 std:: process:: Command :: new ( "cargo" )
0 commit comments