Skip to content

Commit a7fafe6

Browse files
committed
Be more defensive with R requests while waiting on StdIn
1 parent d2382d2 commit a7fafe6

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

crates/ark/src/console/console_repl.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use crate::dap::dap_notebook;
1515
use crate::data_explorer::r_data_explorer::POSITRON_DATA_EXPLORER_MIME;
1616
use crate::r_task::QueuedRTask;
1717
use crate::r_task::RTask;
18+
use crate::request::DebugRequest;
1819

1920
static RE_DEBUG_PROMPT: Lazy<Regex> = Lazy::new(|| Regex::new(r"Browse\[\d+\]").unwrap());
2021

@@ -1079,11 +1080,13 @@ impl Console {
10791080
// input at a browser prompt, the interrupt handler may send
10801081
// a Quit command to exit the browser cleanly.
10811082
if matches!(wait_for, WaitFor::InputReply) {
1082-
if let RRequest::DebugCommand(ref cmd) = req {
1083-
let input = crate::request::debug_request_command(cmd.clone());
1083+
if let RRequest::DebugCommand(DebugRequest::Quit) = req {
1084+
let input = String::from("Q");
10841085
Self::on_console_input(buf, buflen, input).unwrap();
10851086
return ConsoleResult::NewInput;
10861087
}
1088+
log::warn!("Unexpected R request while waiting for stdin input: {req:?}");
1089+
continue;
10871090
}
10881091

10891092
if let Some(input) = self.handle_execute_request(req, info, buf, buflen) {

0 commit comments

Comments
 (0)