forked from qt-creator/qt-creator
Process: Get rid of setTimeoutS()
Add an extra arg to runBlocking() function instead. Use std::chrono::seconds for timeout. Change-Id: I7c3c21e8f26a2ccbed157d15083d6ef0b4cd2f7e Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -85,9 +85,8 @@ static PythonLanguageServerState checkPythonLanguageServer(const FilePath &pytho
|
||||
return {PythonLanguageServerState::AlreadyInstalled, lspPath};
|
||||
|
||||
Process pythonProcess;
|
||||
pythonProcess.setTimeoutS(2);
|
||||
pythonProcess.setCommand({python, {"-m", "pip", "-V"}});
|
||||
pythonProcess.runBlocking();
|
||||
pythonProcess.runBlocking(std::chrono::seconds(2));
|
||||
if (pythonProcess.allOutput().startsWith("pip "))
|
||||
return {PythonLanguageServerState::CanBeInstalled, lspPath};
|
||||
return {PythonLanguageServerState::CanNotBeInstalled, FilePath()};
|
||||
|
||||
@@ -70,9 +70,8 @@ static Interpreter createInterpreter(const FilePath &python,
|
||||
|
||||
Process pythonProcess;
|
||||
pythonProcess.setProcessChannelMode(QProcess::MergedChannels);
|
||||
pythonProcess.setTimeoutS(1);
|
||||
pythonProcess.setCommand({python, {"--version"}});
|
||||
pythonProcess.runBlocking();
|
||||
pythonProcess.runBlocking(std::chrono::seconds(1));
|
||||
if (pythonProcess.result() == ProcessResult::FinishedWithSuccess)
|
||||
result.name = pythonProcess.cleanedStdOut().trimmed();
|
||||
if (result.name.isEmpty())
|
||||
|
||||
@@ -148,9 +148,8 @@ QString pythonName(const FilePath &pythonPath)
|
||||
QString name = nameForPython.value(pythonPath);
|
||||
if (name.isEmpty()) {
|
||||
Process pythonProcess;
|
||||
pythonProcess.setTimeoutS(2);
|
||||
pythonProcess.setCommand({pythonPath, {"--version"}});
|
||||
pythonProcess.runBlocking();
|
||||
pythonProcess.runBlocking(std::chrono::seconds(2));
|
||||
if (pythonProcess.result() != ProcessResult::FinishedWithSuccess)
|
||||
return {};
|
||||
name = pythonProcess.allOutput().trimmed();
|
||||
|
||||
Reference in New Issue
Block a user