Skip to content

Commit 39d9acc

Browse files
committed
Add a delay before sending the signal.
1 parent 20b8c4c commit 39d9acc

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/codelldb/src/debug_session/launch.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use super::*;
77
use adapter_protocol::*;
88
use lldb::*;
99
use std::ffi::OsStr;
10+
use std::time::Duration;
1011

1112
impl super::DebugSession {
1213
pub(super) fn report_launch_cfg_error(&mut self, err: serde_json::Error) -> Result<ResponseBody, Error> {
@@ -359,12 +360,15 @@ impl super::DebugSession {
359360
// Resume before sending the signal.
360361
log_errors!(process.resume());
361362
for _ in 0..10 {
362-
if process.state().is_running() {
363+
let state = process.state();
364+
// Sleep unconditionally; without this pause signals sometimes never arrive.
365+
std::thread::sleep(Duration::from_millis(100));
366+
if state.is_running() {
363367
break;
364368
}
365-
std::thread::sleep(std::time::Duration::from_millis(100));
366369
}
367370
}
371+
debug!("Sending signal {signo}");
368372
process.signal(signo)?;
369373
}
370374
Some(Either::Second(commands)) => {

src/codelldb/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::prelude::*;
22
use std::sync::Arc;
3+
use std::time::Duration;
34
use std::{env, net};
45

56
use adapter_protocol::AdapterSettings;
@@ -8,7 +9,6 @@ use dap_session::DAPChannel;
89
use lldb::*;
910
use tokio::io::AsyncWriteExt;
1011
use tokio::net::{TcpListener, TcpStream};
11-
use tokio::time::Duration;
1212
use tokio_util::codec::Decoder;
1313

1414
#[allow(unused_imports)]

0 commit comments

Comments
 (0)