comparison src/plugincandidates.cpp @ 13:8545be78b994

OSX build fixes and logic
author Chris Cannam <cannam@all-day-breakfast.com>
date Tue, 25 Oct 2016 14:48:56 +0100
parents 92e72014d979
children 8643d4d1cb14
comparison
equal deleted inserted replaced
12:92e72014d979 13:8545be78b994
148 QProcess process; 148 QProcess process;
149 process.setReadChannel(QProcess::StandardOutput); 149 process.setReadChannel(QProcess::StandardOutput);
150 process.setProcessChannelMode(QProcess::ForwardedErrorChannel); 150 process.setProcessChannelMode(QProcess::ForwardedErrorChannel);
151 process.start(m_helper.c_str(), { descriptor.c_str() }); 151 process.start(m_helper.c_str(), { descriptor.c_str() });
152 if (!process.waitForStarted()) { 152 if (!process.waitForStarted()) {
153 cerr << "helper failed to start" << endl; 153 QProcess::ProcessError err = process.error();
154 if (err == QProcess::FailedToStart) {
155 std::cerr << "Unable to start helper process " << m_helper
156 << std::endl;
157 } else if (err == QProcess::Crashed) {
158 std::cerr << "Helper process " << m_helper
159 << " crashed on startup" << std::endl;
160 } else {
161 std::cerr << "Helper process " << m_helper
162 << " failed on startup with error code "
163 << err << std::endl;
164 }
154 throw runtime_error("plugin load helper failed to start"); 165 throw runtime_error("plugin load helper failed to start");
155 } 166 }
156 for (auto &lib: libraries) { 167 for (auto &lib: libraries) {
157 process.write(lib.c_str(), lib.size()); 168 process.write(lib.c_str(), lib.size());
158 process.write("\n", 1); 169 process.write("\n", 1);
194 205
195 if (process.state() != QProcess::NotRunning) { 206 if (process.state() != QProcess::NotRunning) {
196 process.close(); 207 process.close();
197 process.waitForFinished(); 208 process.waitForFinished();
198 } 209 }
199 210
211 log("helper completed");
212
200 return output; 213 return output;
201 } 214 }
202 215
203 void 216 void
204 PluginCandidates::recordResult(string tag, vector<string> result) 217 PluginCandidates::recordResult(string tag, vector<string> result)