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 1 commit
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
8 changes: 6 additions & 2 deletions src/rust/engine/process_execution/src/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,11 @@ pub fn setup_run_sh_script(
let formatted_assignment = format!("{key}={arg_str}");
env_var_strings.push(formatted_assignment);
}
let stringified_env_vars: String = env_var_strings.join(" ");
let stringified_env_var_export: String = if env_var_strings.is_empty() {
benjyw marked this conversation as resolved.
Show resolved Hide resolved
"".to_owned()
} else {
"export ".to_owned() + &env_var_strings.join(" ")
benjyw marked this conversation as resolved.
Show resolved Hide resolved
};

// Shell-quote every command-line argument, as necessary.
let mut full_command_line: Vec<String> = vec![];
Expand Down Expand Up @@ -878,7 +882,7 @@ 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}
{stringified_env_var_export}
benjyw marked this conversation as resolved.
Show resolved Hide resolved
cd {stringified_cwd}
{stringified_command_line}
",
Expand Down