From 0ddbe0c7575acb78e5229d54c2e5c5cacdd1a87c Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 14 Jun 2021 17:27:00 +0200 Subject: [PATCH] Make drop test more reliable --- zed/src/rpc_client.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/zed/src/rpc_client.rs b/zed/src/rpc_client.rs index 003bf3f3a4..9592d33785 100644 --- a/zed/src/rpc_client.rs +++ b/zed/src/rpc_client.rs @@ -184,13 +184,16 @@ mod tests { drop(client); // Try sending an empty payload over and over, until the client is dropped and hangs up. - let error = loop { - match server_conn.write(&[0]).await { - Ok(_) => continue, - Err(err) => break err, + loop { + match server_conn.write(&[]).await { + Ok(_) => {} + Err(err) => { + if err.kind() == io::ErrorKind::BrokenPipe { + break; + } + } } - }; - assert_eq!(error.kind(), io::ErrorKind::BrokenPipe); + } } async fn send_recv(mut sender: S, receiver: R) -> O