From d0d16931e330780f480c9676f33de4ca0516f36c Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Tue, 4 Feb 2025 08:47:27 -0500 Subject: [PATCH] DAP: Configure child process stderr as piped By default this is `Stdio::inherit` which sends stderr from the child process to Helix. Instead we should use `Stdio::piped` which allows us to read the piped output. We can also expect that the stderr opens now (it should similarly to stdout), so that we always start a reader for stderr like the LSP client. --- helix-dap/src/client.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/helix-dap/src/client.rs b/helix-dap/src/client.rs index ed4515fe9..e0e4d56b5 100644 --- a/helix-dap/src/client.rs +++ b/helix-dap/src/client.rs @@ -119,6 +119,7 @@ impl Client { .args(args) .stdin(Stdio::piped()) .stdout(Stdio::piped()) + .stderr(Stdio::piped()) // make sure the process is reaped on drop .kill_on_drop(true) .spawn(); @@ -128,16 +129,12 @@ impl Client { // TODO: do we need bufreader/writer here? or do we use async wrappers on unblock? let writer = BufWriter::new(process.stdin.take().expect("Failed to open stdin")); let reader = BufReader::new(process.stdout.take().expect("Failed to open stdout")); - let errors = process.stderr.take().map(BufReader::new); + let stderr = BufReader::new(process.stderr.take().expect("Failed to open stderr")); Self::streams( Box::new(BufReader::new(reader)), Box::new(writer), - // errors.map(|errors| Box::new(BufReader::new(errors))), - match errors { - Some(errors) => Some(Box::new(BufReader::new(errors))), - None => None, - }, + Some(Box::new(stderr)), id, Some(process), )