SERVER-114396 raise error message from launch targets script (#44396)

GitOrigin-RevId: 33e1d740c49c9438a50e1b8e3a43923091f958dd
This commit is contained in:
Daniel Moody 2025-11-25 09:29:08 -06:00 committed by MongoDB Bot
parent d8496c0a18
commit e1ead5d9d9
2 changed files with 23 additions and 1 deletions

View File

@ -309,7 +309,7 @@
"id": "runTargets", "id": "runTargets",
"command": "shellCommand.execute", "command": "shellCommand.execute",
"args": { "args": {
"command": "buildscripts/vscode_launch_targets.sh 2> /dev/null", "command": "buildscripts/vscode_launch_targets.sh",
"cwd": "${workspaceFolder}", "cwd": "${workspaceFolder}",
"taskId": "runTargets", "taskId": "runTargets",
"rememberPrevious": true, "rememberPrevious": true,

View File

@ -1,6 +1,28 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail 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 # 1) what we want to query
QUERY=${1:-"attr(tags, \"mongo_binary\", //...) union attr(tags, \"mongo_unittest\", //...)"} QUERY=${1:-"attr(tags, \"mongo_binary\", //...) union attr(tags, \"mongo_unittest\", //...)"}