Commit 864d2d70 authored by Florent Viard's avatar Florent Viard Committed by Francis Herne

Ensure that codestyle.py always returns something on stdout to unlock m_mutex.

By returning only a "0" size on stdout, pythonstylechecking.cpp will
 see a "reply" and unlock the m_mutex.

This avoids serious UI hangs when the stylechecker is enabled but
 `pycodestyle` is not installed.

BUG: 392031
Differential Revision: https://phabricator.kde.org/D11474
parent c419dba8
......@@ -46,3 +46,5 @@ while True:
else:
stderr.write("The `pycodestyle` (previously `pep8`) module is not installed.")
stderr.flush()
stdout.write("{0:>10}".format(0))
stdout.flush()
......@@ -67,12 +67,14 @@ void StyleChecking::startChecker(const QString& text, const QString& select,
auto serverPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kdevpythonsupport/codestyle.py");
if ( serverPath.isEmpty() ) {
qWarning() << "setup problem: codestyle.py not found";
m_mutex.unlock();
return;
}
m_checkerProcess.start(python, {serverPath});
m_checkerProcess.waitForStarted(30);
if ( m_checkerProcess.state() != QProcess::Running ) {
qWarning() << "failed to start code checker process";
m_mutex.unlock();
return;
}
}
......
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