forked from qt-creator/qt-creator
FileUtils: Use Process::startDetached() instead of QProcess
Reading data from the detached process is no-op. Change-Id: I128ecc5298e0e6d4a73ecfceba55bc147ffd3a58 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -31,7 +31,6 @@
|
||||
#include <QRegularExpression>
|
||||
#include <QTextStream>
|
||||
#include <QTextCodec>
|
||||
#include <QWidget>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
@@ -82,12 +81,8 @@ void FileUtils::showInGraphicalShell(QWidget *parent, const FilePath &pathIn)
|
||||
if (browserArgs.isEmpty()) {
|
||||
error = Tr::tr("The command for file browser is not set.");
|
||||
} else {
|
||||
QProcess browserProc;
|
||||
browserProc.setProgram(browserArgs.takeFirst());
|
||||
browserProc.setArguments(browserArgs);
|
||||
const bool success = browserProc.startDetached();
|
||||
error = QString::fromLocal8Bit(browserProc.readAllStandardError());
|
||||
if (!success && error.isEmpty())
|
||||
const QString executable = browserArgs.takeFirst();
|
||||
if (!Process::startDetached({FilePath::fromString(executable), browserArgs}))
|
||||
error = Tr::tr("Error while starting file browser.");
|
||||
}
|
||||
if (!error.isEmpty())
|
||||
|
||||
Reference in New Issue
Block a user