Commit b1c113d9 authored by Brad King's avatar Brad King
Browse files

cmake: Do not open directories as scripts (#14966)

Check if a file path is a directory before opening it.  Extend the
RunCMake.CommandLine test with a case running "cmake -P" on a directory.
parent 9e8fa104
...@@ -142,7 +142,8 @@ bool cmListFile::ParseFile(const char* filename, ...@@ -142,7 +142,8 @@ bool cmListFile::ParseFile(const char* filename,
bool topLevel, bool topLevel,
cmMakefile *mf) cmMakefile *mf)
{ {
if(!cmSystemTools::FileExists(filename)) if(!cmSystemTools::FileExists(filename) ||
{ {
return false; return false;
} }
^CMake Error: Error processing file: .*/Tests/RunCMake/CommandLine$
...@@ -35,3 +35,5 @@ run_cmake_command(E_sleep-no-args ${CMAKE_COMMAND} -E sleep) ...@@ -35,3 +35,5 @@ run_cmake_command(E_sleep-no-args ${CMAKE_COMMAND} -E sleep)
run_cmake_command(E_sleep-bad-arg1 ${CMAKE_COMMAND} -E sleep x) run_cmake_command(E_sleep-bad-arg1 ${CMAKE_COMMAND} -E sleep x)
run_cmake_command(E_sleep-bad-arg2 ${CMAKE_COMMAND} -E sleep 1 -1) run_cmake_command(E_sleep-bad-arg2 ${CMAKE_COMMAND} -E sleep 1 -1)
run_cmake_command(E_sleep-one-tenth ${CMAKE_COMMAND} -E sleep 0.1) run_cmake_command(E_sleep-one-tenth ${CMAKE_COMMAND} -E sleep 0.1)
run_cmake_command(P_directory ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment