mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
run-tests.php: Remove extra env vars in the generated .sh file (#18306)
This commit is contained in:
parent
3737e0aa6f
commit
0eea5d31e0
1 changed files with 8 additions and 2 deletions
|
@ -2735,8 +2735,14 @@ $output
|
|||
if (!$passed || $leaked) {
|
||||
// write .sh
|
||||
if (strpos($log_format, 'S') !== false) {
|
||||
$env_lines = [];
|
||||
// Unset all environment variables so that we don't inherit extra
|
||||
// ones from the parent process.
|
||||
$env_lines = ['unset $(env | cut -d= -f1)'];
|
||||
foreach ($env as $env_var => $env_val) {
|
||||
if (strval($env_val) === '') {
|
||||
// proc_open does not pass empty env vars
|
||||
continue;
|
||||
}
|
||||
$env_lines[] = "export $env_var=" . escapeshellarg($env_val ?? "");
|
||||
}
|
||||
$exported_environment = "\n" . implode("\n", $env_lines) . "\n";
|
||||
|
@ -2745,7 +2751,7 @@ $output
|
|||
{$exported_environment}
|
||||
case "$1" in
|
||||
"gdb")
|
||||
gdb --args {$orig_cmd}
|
||||
gdb -ex 'unset environment LINES' -ex 'unset environment COLUMNS' --args {$orig_cmd}
|
||||
;;
|
||||
"lldb")
|
||||
lldb -- {$orig_cmd}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue