Files
CMake/Tests/RunCMake/execute_process/InOutErrDirectory.cmake
Kyle Edwards 35f031e3b2 execute_process(): Restore opening files relative to WORKING_DIRECTORY
Prior to 5420639a, execute_process() would open INPUT_FILE, OUTPUT_FILE,
and ERROR_FILE relative to the WORKING_DIRECTORY argument if it was
provided. Restore this behavior for backwards compatibility.

Fixes: #25338
2023-10-16 12:23:41 -04:00

14 lines
481 B
CMake

file(MAKE_DIRECTORY dir)
file(WRITE dir/in.txt "This is a test")
execute_process(COMMAND ${PRINT_STDIN_EXE} WORKING_DIRECTORY dir INPUT_FILE in.txt OUTPUT_FILE out.txt ERROR_FILE err.txt)
if(NOT EXISTS dir/out.txt)
message(SEND_ERROR "Did not create dir/out.txt")
endif()
file(READ dir/out.txt out)
if(NOT out STREQUAL "This is a test")
message(SEND_ERROR "Did not read dir/in.txt")
endif()
if(NOT EXISTS dir/err.txt)
message(SEND_ERROR "Did not create dir/err.txt")
endif()