diff options
author | Brad King <brad.king@kitware.com> | 2021-09-21 15:04:42 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-09-21 15:05:06 (GMT) |
commit | b0b689d5660f8f6d2a05bf070b2c72ddf3091b75 (patch) | |
tree | c3a9865ea36f2fc93fd251791bdb3c3aa891d08d | |
parent | 5fa9a65b1eb659462affe8b565d1da828a9d8f4a (diff) | |
parent | 0b4a56e64b52ac050e42192c635bd59527cd98b7 (diff) | |
download | CMake-b0b689d5660f8f6d2a05bf070b2c72ddf3091b75.zip CMake-b0b689d5660f8f6d2a05bf070b2c72ddf3091b75.tar.gz CMake-b0b689d5660f8f6d2a05bf070b2c72ddf3091b75.tar.bz2 |
Merge topic 'cat_empty_file'
0b4a56e64b cmake: -E cat stops when an empty file is encountered
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6539
-rw-r--r-- | Source/cmcmd.cxx | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 1e0f497..3e36f97 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -1068,6 +1068,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args, } else if (!cmSystemTools::FileExists(arg)) { cmSystemTools::Error(arg + ": no such file or directory (ignoring)"); return_value = 1; + } else if (cmSystemTools::FileLength(arg) == 0) { + // Ignore empty files, this is not an error } else { // Destroy console buffers to drop cout/cerr encoding transform. consoleBuf.reset(); diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index cea5b1b..dc066f1 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -647,9 +647,10 @@ run_cmake_command(E_cat_directory file(WRITE "${out}/first_file.txt" "first file to append\n") file(WRITE "${out}/second_file.txt" "second file to append\n") +file(WRITE "${out}/empty_file.txt" "") file(WRITE "${out}/unicode_file.txt" "àéùç - 한국어") # Korean in Korean run_cmake_command(E_cat_good_cat - ${CMAKE_COMMAND} -E cat "${out}/first_file.txt" "${out}/second_file.txt" "${out}/unicode_file.txt") + ${CMAKE_COMMAND} -E cat "${out}/first_file.txt" "${out}/second_file.txt" "${out}/empty_file.txt" "${out}/unicode_file.txt") unset(out) run_cmake_command(E_cat_good_binary_cat |