From f211020ec2d00bd48e4c55ce6c3b28e1617f9660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Schr=C3=B6ter?= Date: Thu, 9 Feb 2023 20:29:50 +0100 Subject: [PATCH] fix: ignore non-json lines in cargoBuildLog Fixes issues with non-json values in cargoBuildLog: rust-lang/cargo#8179 --- lib/setupHooks/installFromCargoBuildLogHook.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/setupHooks/installFromCargoBuildLogHook.sh b/lib/setupHooks/installFromCargoBuildLogHook.sh index b0094307..ad105ae5 100644 --- a/lib/setupHooks/installFromCargoBuildLogHook.sh +++ b/lib/setupHooks/installFromCargoBuildLogHook.sh @@ -9,6 +9,9 @@ function installFromCargoBuildLog() ( echo searching for bins/libs to install from cargo build log at ${log} + local logs + logs=$(jq -R 'fromjson?' <"${log}") + local select_non_test='select(.reason == "compiler-artifact" and .profile.test == false)' local select_bins="${select_non_test} | .executable | select(.!= null)" local select_lib_files="${select_non_test}"' @@ -29,12 +32,12 @@ function installFromCargoBuildLog() ( rmdir --ignore-fail-on-non-empty "${loc}" } - jq -r <"${log}" "${select_bins}" | installArtifacts "${dest}/bin" + echo "${logs}" | jq -r "${select_bins}" | installArtifacts "${dest}/bin" command cargo metadata --format-version 1 | jq '.workspace_members[]' | ( while IFS= read -r ws_member; do local select_member_libs="select(.package_id == ${ws_member}) | ${select_lib_files}" - jq -r <"${log}" "${select_member_libs}" | installArtifacts "${dest}/lib" + echo "${logs}" | jq -r "${select_member_libs}" | installArtifacts "${dest}/lib" done )