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:
Jarek Kobus
2023-08-08 21:15:45 +02:00
parent 0ffc4ac89e
commit 886205b149

View File

@@ -31,7 +31,6 @@
#include <QRegularExpression> #include <QRegularExpression>
#include <QTextStream> #include <QTextStream>
#include <QTextCodec> #include <QTextCodec>
#include <QWidget>
using namespace Utils; using namespace Utils;
@@ -82,12 +81,8 @@ void FileUtils::showInGraphicalShell(QWidget *parent, const FilePath &pathIn)
if (browserArgs.isEmpty()) { if (browserArgs.isEmpty()) {
error = Tr::tr("The command for file browser is not set."); error = Tr::tr("The command for file browser is not set.");
} else { } else {
QProcess browserProc; const QString executable = browserArgs.takeFirst();
browserProc.setProgram(browserArgs.takeFirst()); if (!Process::startDetached({FilePath::fromString(executable), browserArgs}))
browserProc.setArguments(browserArgs);
const bool success = browserProc.startDetached();
error = QString::fromLocal8Bit(browserProc.readAllStandardError());
if (!success && error.isEmpty())
error = Tr::tr("Error while starting file browser."); error = Tr::tr("Error while starting file browser.");
} }
if (!error.isEmpty()) if (!error.isEmpty())