diff --git a/source/carla_database.py b/source/carla_database.py index 90406f5d0..ab2f9e0a1 100755 --- a/source/carla_database.py +++ b/source/carla_database.py @@ -22,10 +22,6 @@ from copy import deepcopy from subprocess import Popen, PIPE -#try: - #from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QThread, QSettings - #from PyQt5.QtWidgets import QDialog, QTableWidgetItem -#except: from PyQt4.QtCore import pyqtSignal, pyqtSlot, Qt, QThread, QSettings from PyQt4.QtGui import QDialog, QTableWidgetItem @@ -169,10 +165,23 @@ def runCarlaDiscovery(itype, stype, filename, tool, isWine=False): plugins = [] fakeLabel = os.path.basename(filename).rsplit(".", 1)[0] - while gDiscoveryProcess.poll() is None: + while True: try: - line = gDiscoveryProcess.stdout.readline().decode("utf-8", errors="ignore").strip() + line = gDiscoveryProcess.stdout.readline().decode("utf-8", errors="ignore") except: + print("ERROR: discovery readline failed") + break + + # line is valid, strip it + if line: + line = line.strip() + + # line is invalid, try poll() again + elif gDiscoveryProcess.poll() is None: + continue + + # line is invalid and poll() failed, stop here + else: break if line == "carla-discovery::init::-----------": @@ -205,7 +214,7 @@ def runCarlaDiscovery(itype, stype, filename, tool, isWine=False): try: prop, value = line.replace("carla-discovery::", "").split("::", 1) except: - continue + continue if prop == "name": pinfo['name'] = value if value else fakeLabel diff --git a/source/discovery/carla-discovery.cpp b/source/discovery/carla-discovery.cpp index 53b839779..3689c5768 100644 --- a/source/discovery/carla-discovery.cpp +++ b/source/discovery/carla-discovery.cpp @@ -1804,14 +1804,6 @@ int main(int argc, char* argv[]) if (openLib) { - handle = lib_open(filename); - - if (handle == nullptr) - { - print_lib_error(filename); - return 1; - } - if (filenameStr.contains("fluidsynth", true)) { DISCOVERY_OUT("info", "skipping fluidsynth based plugin"); @@ -1822,6 +1814,14 @@ int main(int argc, char* argv[]) DISCOVERY_OUT("info", "skipping linuxsampler based plugin"); return 0; } + + handle = lib_open(filename); + + if (handle == nullptr) + { + print_lib_error(filename); + return 1; + } } // never do init for dssi-vst, takes too long and it's crashy