mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 09:26:19 +04:00
Run debug console in windows (#2294)
This commit is contained in:
parent
2cb1ea7127
commit
c80ac84978
@ -4,6 +4,7 @@
|
||||
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 @@ pub async fn handle_debugger_message(&mut self, payload: helix_dap::Payload) ->
|
||||
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(
|
||||
|
Loading…
Reference in New Issue
Block a user