diff options
author | Ken Moore <moorekou@gmail.com> | 2016-06-30 15:36:44 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2016-06-30 15:36:44 -0400 |
commit | 3f2d4bb80db5c04bfd4c47696049f7ba7233a6f7 (patch) | |
tree | 00f5d2fef3b62d2833f8708ba2a5c54aff6f0382 /src-qt5/core/libLumina/LuminaUtils.cpp | |
parent | Fix the check routine in the new script finder dialog. (diff) | |
download | lumina-3f2d4bb80db5c04bfd4c47696049f7ba7233a6f7.tar.gz lumina-3f2d4bb80db5c04bfd4c47696049f7ba7233a6f7.tar.bz2 lumina-3f2d4bb80db5c04bfd4c47696049f7ba7233a6f7.zip |
Ensure that the quick command run routine will never hang the system for more than 1 second of inactivity from the subprocess.
Diffstat (limited to 'src-qt5/core/libLumina/LuminaUtils.cpp')
-rw-r--r-- | src-qt5/core/libLumina/LuminaUtils.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src-qt5/core/libLumina/LuminaUtils.cpp b/src-qt5/core/libLumina/LuminaUtils.cpp index 1d0e186c..76d61f8d 100644 --- a/src-qt5/core/libLumina/LuminaUtils.cpp +++ b/src-qt5/core/libLumina/LuminaUtils.cpp @@ -34,15 +34,19 @@ inline QStringList ProcessRun(QString cmd, QStringList args){ proc.setProcessEnvironment(env); proc.setProcessChannelMode(QProcess::MergedChannels); if(args.isEmpty()){ - proc.start(cmd); + proc.start(cmd, QIODevice::ReadOnly); }else{ - proc.start(cmd,args); + proc.start(cmd,args ,QIODevice::ReadOnly); } - while(!proc.waitForFinished(500)){ + QString info; + while(!proc.waitForFinished(1000)){ if(proc.state() == QProcess::NotRunning){ break; } //somehow missed the finished signal + QString tmp = proc.readAllStandardOutput(); + if(tmp.isEmpty()){ proc.terminate(); } + else{ info.append(tmp); } } out[0] = QString::number(proc.exitCode()); - out[1] = QString(proc.readAllStandardOutput()); + out[1] = info+QString(proc.readAllStandardOutput()); return out; } //============= |