Mercurial > hg > piper-cpp
changeset 114:95c94a86c902
Fix maddening failure to start server with space in its path
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Tue, 25 Oct 2016 21:06:38 +0100 |
parents | ac4a9518e1cc |
children | 5a716f08e4be |
files | vamp-client/ProcessQtTransport.h |
diffstat | 1 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/vamp-client/ProcessQtTransport.h Tue Oct 25 15:51:55 2016 +0100 +++ b/vamp-client/ProcessQtTransport.h Tue Oct 25 21:06:38 2016 +0100 @@ -30,7 +30,17 @@ m_process = new QProcess(); m_process->setReadChannel(QProcess::StandardOutput); m_process->setProcessChannelMode(QProcess::ForwardedErrorChannel); - m_process->start(processName.c_str()); + QString name(QString::fromStdString(processName)); + + // The second argument here is vital, otherwise we get a + // different start() overload which parses all command args + // out of its first argument only and therefore fails when + // name has a space in it. This is such a gotcha that Qt5.6 + // even introduced a QT_NO_PROCESS_COMBINED_ARGUMENT_START + // build flag to disable that overload. Unfortunately I only + // discovered that after wasting almost a day on it. + m_process->start(name, QStringList()); + if (!m_process->waitForStarted()) { if (m_process->state() == QProcess::NotRunning) { QProcess::ProcessError err = m_process->error();