From 6b64be4f1604ca16f8a9cdb31481a6cd0d5c5d9d Mon Sep 17 00:00:00 2001 From: Malte Poll <1780588+malt3@users.noreply.github.com> Date: Tue, 4 Jun 2024 13:49:48 +0200 Subject: [PATCH] always set 'use_default_shell_env' in ctx.actions.run Aspect uses shell wrappers that invoke tools like `dirname` and `uname`. When the default shell env is not inherited, this prevents tools from being found on systems without a working fallback $PATH (like NixOS). See also: https://github.com/NixOS/nixpkgs/issues/289505 --- ts/private/ts_project.bzl | 1 + ts/private/ts_proto_library.bzl | 1 + ts/private/ts_validate_options.bzl | 1 + 3 files changed, 3 insertions(+) diff --git a/ts/private/ts_project.bzl b/ts/private/ts_project.bzl index f4807ea8..f40677c2 100644 --- a/ts/private/ts_project.bzl +++ b/ts/private/ts_project.bzl @@ -260,6 +260,7 @@ This is an error because Bazel does not run actions unless their outputs are nee env = { "BAZEL_BINDIR": ctx.bin_dir.path, }, + use_default_shell_env = True, ) transitive_sources = js_lib_helpers.gather_transitive_sources(output_sources, ctx.attr.srcs + [ctx.attr.tsconfig] + ctx.attr.deps) diff --git a/ts/private/ts_proto_library.bzl b/ts/private/ts_proto_library.bzl index 4fead054..c9c8dd4a 100644 --- a/ts/private/ts_proto_library.bzl +++ b/ts/private/ts_proto_library.bzl @@ -60,6 +60,7 @@ def _protoc_action(ctx, proto_info, outputs, options = { [ctx.executable.protoc_gen_connect_query] if ctx.attr.gen_connect_query else [] ), env = {"BAZEL_BINDIR": ctx.bin_dir.path}, + use_default_shell_env = True, ) def _declare_outs(ctx, info, ext): diff --git a/ts/private/ts_validate_options.bzl b/ts/private/ts_validate_options.bzl index 4739b200..ba2acb21 100644 --- a/ts/private/ts_validate_options.bzl +++ b/ts/private/ts_validate_options.bzl @@ -78,6 +78,7 @@ def _validate_action(ctx, tsconfig_inputs): env = { "BAZEL_BINDIR": ctx.bin_dir.path, }, + use_default_shell_env = True, ) return [marker]