Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/node/node.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def _nodejs_binary_impl(ctx, data = [], runfiles = [], expanded_args = []):

# Add all env vars from the ctx attr
for [key, value] in ctx.attr.env.items():
env_vars += "export %s=%s\n" % (key, ctx.expand_make_variables("env", expand_location_into_runfiles(ctx, value, data), {}))
env_vars += "export %s=\"%s\"\n" % (key, ctx.expand_make_variables("env", expand_location_into_runfiles(ctx, value, data), {}))

# While we can derive the workspace from the pwd when running locally
# because it is in the execroot path `execroot/my_wksp`, on RBE the
Expand Down
1 change: 1 addition & 0 deletions internal/node/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ nodejs_binary(
env = {
"LOC": "$(location :dump_build_env.js)",
"SOME_TEST_ENV": "$(SOME_TEST_ENV)",
"BACKSLASHES": "C:\\some path\\on\\windows.exe",
},
)

Expand Down
5 changes: 5 additions & 0 deletions internal/node/test/env.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,9 @@ describe('launcher.sh environment', function() {
const env = require(runfiles.resolvePackageRelative('dump_build_env_attr.json'));
expect(env['SOME_TEST_ENV']).toBe('some_value')
});

it('should correctly pass environment variables with backslashes', function() {
const env = require(runfiles.resolvePackageRelative('dump_build_env_attr.json'));
expect(env['BACKSLASHES']).toBe('C:\\some path\\on\\windows.exe');
});
});