From 737758065cac5781b31e559220ad7635f7116408 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 30 Sep 2015 09:22:24 -0400 Subject: Fix an issue with the runCmd() and getCmdOutput() functions in libLumina - ensure that the process was started first before going into the "wait loop" afterwards. This should fix race conditions where Lumina was trying to call an application which was not installed on the system, or the application does not startup for some reason. --- libLumina/LuminaUtils.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libLumina/LuminaUtils.cpp') diff --git a/libLumina/LuminaUtils.cpp b/libLumina/LuminaUtils.cpp index 60605e65..5f2de8b3 100644 --- a/libLumina/LuminaUtils.cpp +++ b/libLumina/LuminaUtils.cpp @@ -36,6 +36,7 @@ int LUtils::runCmd(QString cmd, QStringList args){ }else{ proc.start(cmd, args); } + if(!proc.waitForStarted(30000)){ return 1; } //process never started - max wait of 30 seconds while(!proc.waitForFinished(300)){ QCoreApplication::processEvents(); } @@ -56,6 +57,7 @@ QStringList LUtils::getCmdOutput(QString cmd, QStringList args){ }else{ proc.start(cmd,args); } + if(!proc.waitForStarted(30000)){ return QStringList(); } //process never started - max wait of 30 seconds while(!proc.waitForFinished(500)){ QCoreApplication::processEvents(); } -- cgit