@@ -44,16 +44,24 @@ if(COPY)
4444endif ()
4545
4646if (PRE)
47- string (REPLACE "^" ";" _pre ${PRE} )
47+ set (PRE_LIST ${PRE} )
48+ separate_arguments (${PRE_LIST} )
49+ string (REPLACE " " ";" _preargs ${PRE_LIST} )
50+ list (GET _preargs 0 _precmd)
51+ list (REMOVE_AT _preargs 0)
4852 if (DBG)
49- message (STATUS "testdriver:PRE=${_pre} " )
53+ message (STATUS "testdriver:PRE=${_pre}${preargs} " )
5054 endif ()
5155endif ()
5256
5357if (POST)
54- string (REPLACE "^" ";" _post ${POST} )
58+ set (POST_LIST ${POST} )
59+ separate_arguments (${POST_LIST} )
60+ string (REPLACE " " ";" _postargs ${POST_LIST} )
61+ list (GET _postargs 0 _postcmd)
62+ list (REMOVE_AT _postargs 0)
5563 if (DBG)
56- message (STATUS "testdriver:POST=${_post } " )
64+ message (STATUS "testdriver:POST=${_postcmd}${_postargs } " )
5765 endif ()
5866endif ()
5967
@@ -111,7 +119,7 @@ endif()
111119
112120#---Execute pre-command-----------------------------------------------------------------------------
113121if (PRE)
114- execute_process (COMMAND ${_pre} ${_cwd} RESULT_VARIABLE _rc)
122+ execute_process (COMMAND ${_pre} {_precmd} ${_cwd} RESULT_VARIABLE _rc)
115123 if (_rc)
116124 message (FATAL_ERROR "pre-command error code : ${_rc} " )
117125 endif ()
@@ -143,7 +151,7 @@ if(CMD)
143151 set (_chkerr ERROR_VARIABLE _errvar2) # Only check out eventually
144152 endif ()
145153 endif ()
146-
154+
147155 execute_process (COMMAND ${_cmd} ${_input} ${_chkout} ${_chkerr} WORKING_DIRECTORY ${CWD} RESULT_VARIABLE _rc)
148156
149157 string (REGEX REPLACE "([.]*)[;][-][e][;]([^;]+)([.]*)" "\\ 1;-e '\\ 2\\ 3'" res "${_cmd} " )
@@ -243,7 +251,7 @@ endif()
243251
244252#---Execute post-command-----------------------------------------------------------------------------
245253if (POST)
246- execute_process (COMMAND ${_post } ${_cwd} OUTPUT_VARIABLE _outvar ERROR_VARIABLE _outvar RESULT_VARIABLE _rc)
254+ execute_process (COMMAND ${_postcmd} ${_postargs } ${_cwd} OUTPUT_VARIABLE _outvar ERROR_VARIABLE _outvar RESULT_VARIABLE _rc)
247255 if (_outvar)
248256 message ("-- BEGIN POST OUTPUT --" )
249257 message ("${_outvar} " )
0 commit comments