Skip to content

Commit

Permalink
Document and workaround run_shell issues on macOS.
Browse files Browse the repository at this point in the history
This will let other starlark assume command/run_shell work as documented
and the workaround for the shell issues will be hidden from them.

PiperOrigin-RevId: 226057259
  • Loading branch information
thomasvl authored and sergiocampama committed Dec 19, 2018
1 parent b0c17b9 commit 0275764
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/apple_support.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,17 @@ def _run_shell(ctx, **kwargs):
**kwargs: See `ctx.actions.run` for the rest of the available arguments.
"""
_validate_attribute_present(ctx, "_xcode_config")

# TODO(b/77637734) remove "workaround" once the bazel issue is resolved.
# Bazel doesn't always get the shell right for a single string `commands`;
# so work around that case by faking it as a list of strings that forces
# the shell correctly.
command = kwargs.get("command")
if command and type(command) == type(""):
processed_args = dict(kwargs)
processed_args["command"] = ["/bin/sh", "-c", command]
kwargs = processed_args

ctx.actions.run_shell(**_kwargs_for_apple_platform(ctx, **kwargs))

apple_support = struct(
Expand Down

0 comments on commit 0275764

Please sign in to comment.