fix: don't pass too long env

This commit is contained in:
iff 2025-01-20 15:54:45 +01:00
parent d9dafcc7f3
commit 829978f662
2 changed files with 15 additions and 3 deletions

View file

@ -310,7 +310,14 @@ pub fn module_output(data: &Data, module: &str) -> Option<Vec<String>> {
let executable = &data.split[0]; let executable = &data.split[0];
let last_command = &data.command; let last_command = &data.command;
let error_msg = &data.error; let error_msg = &data.error;
let executables = data.executables.clone().join(" "); let executables = {
let exes = data.executables.clone().join(" ");
if exes.len() < 100_000 {
exes
} else {
"".to_string()
}
};
let output = std::process::Command::new(shell) let output = std::process::Command::new(shell)
.arg("-c") .arg("-c")
.arg(module) .arg(module)

View file

@ -16,6 +16,7 @@
mod replaces; mod replaces;
mod rules; mod rules;
use pay_respects_utils::files::get_path_files;
fn main() -> Result<(), std::io::Error> { fn main() -> Result<(), std::io::Error> {
let executable = std::env::var("_PR_COMMAND").expect("_PR_COMMAND not set"); let executable = std::env::var("_PR_COMMAND").expect("_PR_COMMAND not set");
@ -23,8 +24,12 @@ fn main() -> Result<(), std::io::Error> {
let last_command = std::env::var("_PR_LAST_COMMAND").expect("_PR_LAST_COMMAND not set"); let last_command = std::env::var("_PR_LAST_COMMAND").expect("_PR_LAST_COMMAND not set");
let error_msg = std::env::var("_PR_ERROR_MSG").expect("_PR_ERROR_MSG not set"); let error_msg = std::env::var("_PR_ERROR_MSG").expect("_PR_ERROR_MSG not set");
let executables: Vec<String> = { let executables: Vec<String> = {
let executables = std::env::var("_PR_EXECUTABLES").expect("_PR_EXECUTABLES not set"); let exes = std::env::var("_PR_EXECUTABLES").expect("_PR_EXECUTABLES not set");
executables.split(" ").map(|s| s.to_string()).collect() if exes.is_empty() {
get_path_files()
} else {
exes.split(" ").map(|s| s.to_string()).collect()
}
}; };
#[cfg(debug_assertions)] #[cfg(debug_assertions)]