Skip to content

Commit b43eff7

Browse files
authored
Fix generated script for vscode debug tasks (#3769)
This is about the tool to debug rust targets in VS Code. When generating the script used in `launch.json`, `stdout` is captured instead of `stderr`. This results in an error when running the task in VS Code (`IndexError: list index out of range`) then in another error from lldb as no target has been registered.
1 parent cdaf15f commit b43eff7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/vscode/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ impl LaunchConfigGenerator {
273273
// 3. Creates the debug target
274274
"script ".to_owned() + &[
275275
"import subprocess, os, sys".to_owned(),
276-
format!("result = subprocess.run(['bazel', 'run', '--compilation_mode=dbg', '--strip=never', '--run_under=@rules_rust//tools/vscode:get_binary_path', '{}'], stdout=subprocess.PIPE, text=True, cwd='${{workspaceFolder}}')", target_info.label),
277-
"binary_path = result.stdout.strip().splitlines()[-1]".to_owned(),
276+
format!("result = subprocess.run(['bazel', 'run', '--compilation_mode=dbg', '--strip=never', '--run_under=@rules_rust//tools/vscode:get_binary_path', '{}'], stderr=subprocess.PIPE, text=True, cwd='${{workspaceFolder}}')", target_info.label),
277+
"binary_path = result.stderr.strip().splitlines()[-1]".to_owned(),
278278
format!("assert binary_path, 'No binary path output for {}'", target_info.label),
279279
"abs_path = os.path.join('${workspaceFolder}', binary_path)".to_owned(),
280280
"lldb.debugger.CreateTarget(abs_path)".to_owned(),

0 commit comments

Comments
 (0)