From e1ead5d9d94d0012a2d771282fb30dca186191ea Mon Sep 17 00:00:00 2001 From: Daniel Moody Date: Tue, 25 Nov 2025 09:29:08 -0600 Subject: [PATCH] SERVER-114396 raise error message from launch targets script (#44396) GitOrigin-RevId: 33e1d740c49c9438a50e1b8e3a43923091f958dd --- .../linux-virtual-workstation.code-workspace | 2 +- buildscripts/vscode_launch_targets.sh | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.vscode_defaults/linux-virtual-workstation.code-workspace b/.vscode_defaults/linux-virtual-workstation.code-workspace index be57fe82a4d..3d78c4b5f5c 100644 --- a/.vscode_defaults/linux-virtual-workstation.code-workspace +++ b/.vscode_defaults/linux-virtual-workstation.code-workspace @@ -309,7 +309,7 @@ "id": "runTargets", "command": "shellCommand.execute", "args": { - "command": "buildscripts/vscode_launch_targets.sh 2> /dev/null", + "command": "buildscripts/vscode_launch_targets.sh", "cwd": "${workspaceFolder}", "taskId": "runTargets", "rememberPrevious": true, diff --git a/buildscripts/vscode_launch_targets.sh b/buildscripts/vscode_launch_targets.sh index 3e24a1ad99b..7cb9778a36e 100755 --- a/buildscripts/vscode_launch_targets.sh +++ b/buildscripts/vscode_launch_targets.sh @@ -1,6 +1,28 @@ #!/usr/bin/env bash set -euo pipefail +# Directory where you want the log to end up (VS Code is already setting cwd) +ROOT_DIR=$(pwd) + +tmp_log=$(mktemp) + +cleanup() { + status=$? + if [[ -s "$tmp_log" ]]; then + mv "$tmp_log" "$ROOT_DIR/.vscode_launch_targets.log" + else + rm -f "$tmp_log" + rm -f "$ROOT_DIR/.vscode_launch_targets.log" + fi + exit $status +} +trap cleanup EXIT + +# Save original stderr on fd 3 +exec 3>&2 +# Send stderr through tee: write to tmp_log and still to real stderr (fd 3) +exec 2> >(tee "$tmp_log" >&3) + # 1) what we want to query QUERY=${1:-"attr(tags, \"mongo_binary\", //...) union attr(tags, \"mongo_unittest\", //...)"}