Skip to content

Commit 8dd0ab1

Browse files
committed
print an error message for empty runnable binary wrapper
As a follow up to matt-sm@1d8e362, we are still experiencing intermittent occurances of this issue whereby the wrapper script is empty on windows, and have been unable to reliably repro. This error message will at least give the user a clue of what the actual problem is.
1 parent 146b208 commit 8dd0ab1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

foreign_cc/utils.bzl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,16 @@ def runnable_binary(name, binary, foreign_cc_target, match_binary_name = False,
4949
)
5050

5151
wrapper_cmd = """
52-
sed s@EXECUTABLE@$(rlocationpath {name})@g $(location @rules_foreign_cc//foreign_cc/private:runnable_binary_wrapper.sh) > tmp
52+
wrapper_script=$(location @rules_foreign_cc//foreign_cc/private:runnable_binary_wrapper.sh)
53+
if [[ ! -s "$wrapper_script" ]]; then
54+
echo "ERROR: runnable binary wrapper script does not exist or is empty" >&2
55+
exit 1
56+
fi
57+
sed s@EXECUTABLE@$(rlocationpath {name})@g "$wrapper_script" > tmp
58+
if [[ ! -s tmp ]]; then
59+
echo "ERROR: runnable binary wrapper script is empty" >&2
60+
exit 1
61+
fi
5362
cp tmp $@
5463
"""
5564

0 commit comments

Comments
 (0)