forked from qt-creator/qt-creator
Use QtcProcess inside fake vim handler
Change-Id: I14af193bbf9e7fda9e5b0ba0a1647e19069c40e2 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -59,12 +59,12 @@
|
|||||||
#include "fakevimtr.h"
|
#include "fakevimtr.h"
|
||||||
|
|
||||||
#include <utils/optional.h>
|
#include <utils/optional.h>
|
||||||
|
#include <utils/qtcprocess.h>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QProcess>
|
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
@@ -866,17 +866,10 @@ static QString fromLocalEncoding(const QByteArray &data)
|
|||||||
|
|
||||||
static QString getProcessOutput(const QString &command, const QString &input)
|
static QString getProcessOutput(const QString &command, const QString &input)
|
||||||
{
|
{
|
||||||
QProcess proc;
|
Utils::QtcProcess proc;
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
|
proc.setCommand(Utils::CommandLine::fromUserInput(command));
|
||||||
QStringList arguments = QProcess::splitCommand(command);
|
proc.setWriteData(toLocalEncoding(input));
|
||||||
QString executable = arguments.takeFirst();
|
proc.start();
|
||||||
proc.start(executable, arguments);
|
|
||||||
#else
|
|
||||||
proc.start(command);
|
|
||||||
#endif
|
|
||||||
proc.waitForStarted();
|
|
||||||
proc.write(toLocalEncoding(input));
|
|
||||||
proc.closeWriteChannel();
|
|
||||||
|
|
||||||
// FIXME: Process should be interruptable by user.
|
// FIXME: Process should be interruptable by user.
|
||||||
// Solution is to create a QObject for each process and emit finished state.
|
// Solution is to create a QObject for each process and emit finished state.
|
||||||
|
Reference in New Issue
Block a user