Bugfix for test harness with bad characters in hostname string:
Using a pre-existing CTest command option for removing such characters. Just a cleaner implementation for this bugfix.
This commit is contained in:
parent
2adbd0457a
commit
14c43b4728
2 changed files with 4 additions and 8 deletions
|
@ -52,18 +52,16 @@ function(GetHostName var)
|
|||
execute_process(
|
||||
COMMAND hostname
|
||||
OUTPUT_VARIABLE thisHostname
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND hostname -f
|
||||
OUTPUT_VARIABLE thisHostname
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
endif()
|
||||
|
||||
# Cleanup possible presence of \n or \r characters
|
||||
string(REPLACE "\n" "" thisHostname ${thisHostname})
|
||||
string(REPLACE "\r" "" thisHostname ${thisHostname})
|
||||
|
||||
set(${var} ${thisHostname} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
|
|
@ -52,18 +52,16 @@ function(GetHostName var)
|
|||
execute_process(
|
||||
COMMAND hostname
|
||||
OUTPUT_VARIABLE thisHostname
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND hostname -f
|
||||
OUTPUT_VARIABLE thisHostname
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
endif()
|
||||
|
||||
# Cleanup possible presence of \n or \r characters
|
||||
string(REPLACE "\n" "" thisHostname ${thisHostname})
|
||||
string(REPLACE "\r" "" thisHostname ${thisHostname})
|
||||
|
||||
set(${var} ${thisHostname} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
|
Reference in a new issue