on master help sign in
Run debug console in windows (#2294)
commitc80ac84978fa224498aaae86e2434b568221d216 authorAlexis Kalabura <55039048+axdank@users.noreply.github.com> dateTue 10 May 2022, 21:06 (4 years ago) parent2cb1ea7
1 file changed+26−5
helix-view/src/handlers/dap.rs+26−5
helix-view/src/handlers/dap.rs+26−5
@@ -4,6 +4,7 @@ use helix_core::Selection;
44use helix_dap::{self as dap, Client, Payload, Request, ThreadId};
55use helix_lsp::block_on;
66use log::warn;
7+use std::io::ErrorKind;
78use std::path::PathBuf;
89
910#[macro_export]
@@ -285,11 +286,31 @@ impl Editor {
285286 serde_json::from_value(request.arguments.unwrap_or_default()).unwrap();
286287 // TODO: no unwrap
287288
288− let process = std::process::Command::new("tmux")
289− .arg("split-window")
290− .arg(arguments.args.join(" "))
291− .spawn()
292− .unwrap();
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 {
308+ std::process::Command::new("tmux")
309+ .arg("split-window")
310+ .arg(arguments.args.join(" "))
311+ .spawn()
312+ .unwrap()
313+ };
293314
294315 let _ = debugger
295316 .reply(