Skip to content

Commit c79ec60

Browse files
authored
fixed #12264 - auto-detection of Python in Visual Studio built binaries when python3.exe does not exist (#5765)
I also suppressed the unwanted output from the `system()`.
1 parent 42547aa commit c79ec60

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/cppcheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,10 @@ static std::string detectPython(const CppCheck::ExecuteCmdFn &executeCommand)
226226
std::string out;
227227
#ifdef _MSC_VER
228228
// FIXME: hack to avoid debug assertion with _popen() in executeCommand() for non-existing commands
229-
const std::string cmd = std::string(py_exe) + " --version >NUL";
229+
const std::string cmd = std::string(py_exe) + " --version >NUL 2>&1";
230230
if (system(cmd.c_str()) != 0) {
231231
// TODO: get more detailed error?
232-
break;
232+
continue;
233233
}
234234
#endif
235235
if (executeCommand(py_exe, split("--version"), "2>&1", out) == EXIT_SUCCESS && startsWith(out, "Python ") && std::isdigit(out[7])) {

0 commit comments

Comments
 (0)