Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the entire env in __run.sh #18582

Merged
merged 3 commits into from
Mar 25, 2023
Merged
Changes from 2 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
3 changes: 1 addition & 2 deletions src/rust/engine/process_execution/src/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -878,9 +878,8 @@ pub fn setup_run_sh_script(
let full_script = format!(
"#!/bin/bash
benjyw marked this conversation as resolved.
Show resolved Hide resolved
# This command line should execute the same process as pants did internally.
export {stringified_env_vars}
cd {stringified_cwd}
{stringified_command_line}
env -i {stringified_env_vars} {stringified_command_line}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've done this by hand myself reproing user issues and it worked fine. Did you double check this still works?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, ran a few different command (test, lint, fmt) with --keep-sandboxes=always, cd'd into the sandbox and ran __run.sh to ensure that the process still does the thing we expect it to do.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just checked env -i bash -c 'echo $HOME.' -> ".", but I did not gut check a sandbox __run.sh using this change.

",
);

Expand Down