Skip to content

Commit

Permalink
Remove invalid characters from logfile names on non-Windows (#4469)
Browse files Browse the repository at this point in the history
  • Loading branch information
anrossi authored Aug 16, 2024
1 parent ff4b88b commit 7109203
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/run-gtest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,10 @@ function Start-TestCase([String]$Name, [int]$Trial = 1) {

# Get a string of invalid chars for filenames
$InvalidChars = [System.IO.Path]::GetInvalidFileNameChars() -join ''
if (!$IsWindows) {
# Add characters that Azure disallows in filenames, but aren't invalid on POSIX
$InvalidChars = $InvalidChars,'"', ":", "<", ">", "|", "*", "?", "`r", "`n" -join ''
}
# Escape those chars for use in a regex and put them inside a regex set (the square brackets)
$InvalidCharsToReplace = "[{0}]" -f [RegEx]::Escape($InvalidChars)
$InstanceName = $Name -replace $InvalidCharsToReplace, "_"
Expand Down

0 comments on commit 7109203

Please sign in to comment.