diff options
author | Alexis Kalabura | 2022-05-11 01:06:57 +0000 |
---|---|---|
committer | GitHub | 2022-05-11 01:06:57 +0000 |
commit | c80ac84978fa224498aaae86e2434b568221d216 (patch) | |
tree | 12b0963da6f66d0fc4cc5ac2a708c3b1d21745cc | |
parent | 2cb1ea7127122bbcb0f05dfbb7959334c751c3d7 (diff) |
Run debug console in windows (#2294)
-rw-r--r-- | helix-view/src/handlers/dap.rs | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/helix-view/src/handlers/dap.rs b/helix-view/src/handlers/dap.rs index c69d290d..c7d3758d 100644 --- a/helix-view/src/handlers/dap.rs +++ b/helix-view/src/handlers/dap.rs @@ -4,6 +4,7 @@ use helix_core::Selection; use helix_dap::{self as dap, Client, Payload, Request, ThreadId}; use helix_lsp::block_on; use log::warn; +use std::io::ErrorKind; use std::path::PathBuf; #[macro_export] @@ -285,11 +286,31 @@ impl Editor { serde_json::from_value(request.arguments.unwrap_or_default()).unwrap(); // TODO: no unwrap - let process = std::process::Command::new("tmux") - .arg("split-window") - .arg(arguments.args.join(" ")) - .spawn() - .unwrap(); + let process = if cfg!(windows) { + std::process::Command::new("wt") + .arg("new-tab") + .arg("--title") + .arg("DEBUG") + .arg("cmd") + .arg("/C") + .arg(arguments.args.join(" ")) + .spawn() + .unwrap_or_else(|error| match error.kind() { + ErrorKind::NotFound => std::process::Command::new("conhost") + .arg("cmd") + .arg("/C") + .arg(arguments.args.join(" ")) + .spawn() + .unwrap(), + e => panic!("Error to start debug console: {}", e), + }) + } else { + std::process::Command::new("tmux") + .arg("split-window") + .arg(arguments.args.join(" ")) + .spawn() + .unwrap() + }; let _ = debugger .reply( |