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(
|
execute_process(
|
||||||
COMMAND hostname
|
COMMAND hostname
|
||||||
OUTPUT_VARIABLE thisHostname
|
OUTPUT_VARIABLE thisHostname
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND hostname -f
|
COMMAND hostname -f
|
||||||
OUTPUT_VARIABLE thisHostname
|
OUTPUT_VARIABLE thisHostname
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Cleanup possible presence of \n or \r characters
|
|
||||||
string(REPLACE "\n" "" thisHostname ${thisHostname})
|
|
||||||
string(REPLACE "\r" "" thisHostname ${thisHostname})
|
|
||||||
|
|
||||||
set(${var} ${thisHostname} PARENT_SCOPE)
|
set(${var} ${thisHostname} PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
|
|
@ -52,18 +52,16 @@ function(GetHostName var)
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND hostname
|
COMMAND hostname
|
||||||
OUTPUT_VARIABLE thisHostname
|
OUTPUT_VARIABLE thisHostname
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND hostname -f
|
COMMAND hostname -f
|
||||||
OUTPUT_VARIABLE thisHostname
|
OUTPUT_VARIABLE thisHostname
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Cleanup possible presence of \n or \r characters
|
|
||||||
string(REPLACE "\n" "" thisHostname ${thisHostname})
|
|
||||||
string(REPLACE "\r" "" thisHostname ${thisHostname})
|
|
||||||
|
|
||||||
set(${var} ${thisHostname} PARENT_SCOPE)
|
set(${var} ${thisHostname} PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
|
Reference in a new issue