X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2Fos.cpp;h=ab9d4159a6cc8180864e760f330af3fc95bbb5d7;hb=9234516731fac37651f5dacfc0942dc40775b96e;hp=c381203313d949bbb16ccf1dd2063f02c5aab869;hpb=e485102ef23de8816bd95442dd65571e3c4c2052;p=lyx.git diff --git a/src/support/os.cpp b/src/support/os.cpp index c381203313..ab9d4159a6 100644 --- a/src/support/os.cpp +++ b/src/support/os.cpp @@ -49,7 +49,6 @@ int timeout_min() static string const python23_call(string const & binary, bool verbose = false) { const string version_info = " -c 'from __future__ import print_function;import sys; print(sys.version_info[:2], end=\"\")'"; - static regex const python_reg("\\((\\d*), (\\d*)\\)"); // Default to "python" if no binary is given. if (binary.empty()) return "python -tt"; @@ -60,8 +59,14 @@ static string const python23_call(string const & binary, bool verbose = false) cmd_ret const out = runCommand(binary + version_info); smatch sm; - if (out.first < 0 || !regex_match(out.second, sm, python_reg)) + try { + static regex const python_reg("\\((\\d*), (\\d*)\\)"); + if (out.first < 0 || !regex_match(out.second, sm, python_reg)) + return string(); + } catch(regex_error const & /*e*/) { + LYXERR0("Regex error! This should not happen."); return string(); + } int major = convert(sm.str(1)); int minor = convert(sm.str(2));