Skip to content

Commit

Permalink
runnable_binary: avoid using > on the output file (#1270)
Browse files Browse the repository at this point in the history
Co-authored-by: James Sharpe <[email protected]>
  • Loading branch information
novas0x2a and jsharpe authored Sep 4, 2024
1 parent c939c13 commit 1d8e362
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions foreign_cc/utils.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def runnable_binary(name, binary, foreign_cc_target, match_binary_name = False,

wrapper_cmd = """
sed s@EXECUTABLE@$(rlocationpath {name})@g $(location @rules_foreign_cc//foreign_cc/private:runnable_binary_wrapper.sh) > tmp
sed s@SH_BINARY_FILENAME@{sh_binary_filename}@g tmp > $@
cp tmp $@
"""

if hasattr(native, "package_relative_label"):
Expand All @@ -57,10 +57,7 @@ def runnable_binary(name, binary, foreign_cc_target, match_binary_name = False,
name = name + "_wrapper",
srcs = ["@rules_foreign_cc//foreign_cc/private:runnable_binary_wrapper.sh", name + "_fg"],
outs = [name + "_wrapper.sh"],
cmd = select({
"@platforms//os:windows": wrapper_cmd.format(name = fg_label, sh_binary_filename = binary + ".exe" if match_binary_name else name),
"//conditions:default": wrapper_cmd.format(name = fg_label, sh_binary_filename = binary if match_binary_name else name),
}),
cmd = wrapper_cmd.format(name = fg_label),
tags = tags + ["manual"],
)

Expand Down

0 comments on commit 1d8e362

Please sign in to comment.