on master help sign in
Run debug console in windows (#2294)
c80ac84Alexis Kalabura
helix-view/src/handlers/dap.rs+26−5
@@ -4,6 +4,7 @@ use helix_core::Selection;
4use helix_dap::{self as dap, Client, Payload, Request, ThreadId};
4use helix_dap::{self as dap, Client, Payload, Request, ThreadId};
5use helix_lsp::block_on;
5use helix_lsp::block_on;
6use log::warn;
6use log::warn;
7+use std::io::ErrorKind;
7use std::path::PathBuf;
8use std::path::PathBuf;
8
9
9#[macro_export]
10#[macro_export]
@@ -285,11 +286,31 @@ impl Editor {
285 serde_json::from_value(request.arguments.unwrap_or_default()).unwrap();
286 serde_json::from_value(request.arguments.unwrap_or_default()).unwrap();
286 // TODO: no unwrap
287 // TODO: no unwrap
287
288
289+ let process = if cfg!(windows) {
290+ std::process::Command::new("wt")
291+ .arg("new-tab")
292+ .arg("--title")
293+ .arg("DEBUG")
294+ .arg("cmd")
295+ .arg("/C")
296+ .arg(arguments.args.join(" "))
297+ .spawn()
298+ .unwrap_or_else(|error| match error.kind() {
299+ ErrorKind::NotFound => std::process::Command::new("conhost")
300+ .arg("cmd")
301+ .arg("/C")
302+ .arg(arguments.args.join(" "))
303+ .spawn()
304+ .unwrap(),
305+ e => panic!("Error to start debug console: {}", e),
306+ })
307+ } else {
288− let process = std::process::Command::new("tmux")
308+ std::process::Command::new("tmux")
289− .arg("split-window")
309+ .arg("split-window")
290− .arg(arguments.args.join(" "))
310+ .arg(arguments.args.join(" "))
291− .spawn()
311+ .spawn()
292− .unwrap();
312+ .unwrap()
313+ };
293
314
294 let _ = debugger
315 let _ = debugger
295 .reply(
316 .reply(