Skip to content

Commit

Permalink
refactor: always set use_default_shell_env on generated lifecycle hoo…
Browse files Browse the repository at this point in the history
…k js_run_binary (#1581)
  • Loading branch information
gregmagolan authored Apr 3, 2024
1 parent 58042b7 commit f0fc32d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 3 additions & 5 deletions npm/private/npm_import.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ _LINK_JS_PACKAGE_LIFECYCLE_TMPL = """\
execution_requirements = {lifecycle_hooks_execution_requirements},
mnemonic = "NpmLifecycleHook",
progress_message = "Running lifecycle hooks on npm package {package}@{version}",
env = {lifecycle_hooks_env},{maybe_use_default_shell_env}
env = {lifecycle_hooks_env},
use_default_shell_env = {use_default_shell_env},
)
# post-lifecycle npm_package
Expand Down Expand Up @@ -785,10 +786,7 @@ def _npm_import_links_rule_impl(rctx):
virtual_store_root = utils.virtual_store_root,
maybe_bins = maybe_bins,
dev = rctx.attr.dev,
# Insert nothing when `lifecycle_hooks_use_default_shell_env` is None to remain backwards-compatible
# with bazel-lib `run_binary` before `use_default_shell_env` was added.
# TODO(2.0): remove support for old bazel-lib without `run_binary(use_default_shell_env)`
maybe_use_default_shell_env = "\n use_default_shell_env = True," if rctx.attr.lifecycle_hooks_use_default_shell_env else "",
use_default_shell_env = rctx.attr.lifecycle_hooks_use_default_shell_env,
)

npm_link_package_bzl = [
Expand Down
1 change: 1 addition & 0 deletions npm/private/test/fsevents_links_defs_checked.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ def npm_imported_package_store(name):
mnemonic = "NpmLifecycleHook",
progress_message = "Running lifecycle hooks on npm package [email protected]",
env = {},
use_default_shell_env = False,
)

# post-lifecycle npm_package
Expand Down

0 comments on commit f0fc32d

Please sign in to comment.