Add rdbg for Ruby (#30126)

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2025-05-08 09:37:20 +01:00 committed by GitHub
parent 1ec466b728
commit d39c220f26
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 121 additions and 7 deletions

View file

@ -580,21 +580,31 @@ impl TcpTransport {
.unwrap_or(2000u64)
});
let (rx, tx) = select! {
let (mut process, (rx, tx)) = select! {
_ = cx.background_executor().timer(Duration::from_millis(timeout)).fuse() => {
return Err(anyhow!(format!("Connection to TCP DAP timeout {}:{}", host, port)))
},
result = cx.spawn(async move |cx| {
loop {
match TcpStream::connect(address).await {
Ok(stream) => return stream.split(),
Ok(stream) => return Ok((process, stream.split())),
Err(_) => {
if let Ok(Some(_)) = process.try_status() {
let output = process.output().await?;
let output = if output.stderr.is_empty() {
String::from_utf8_lossy(&output.stdout).to_string()
} else {
String::from_utf8_lossy(&output.stderr).to_string()
};
return Err(anyhow!("{}\nerror: process exited before debugger attached.", output));
}
cx.background_executor().timer(Duration::from_millis(100)).await;
}
}
}
}).fuse() => result
}).fuse() => result?
};
log::info!(
"Debug adapter has connected to TCP server {}:{}",
host,