ProcessInterface: Simplify start() API

Get rid of program and arguments parameters from
start() method. Get rid of customStart() and isCustomStart()
methods. Provide a default implementation for start() method.
Introduce virtual doDefaultStart() method, to be called when
default implementation for start() is used() - it's being
triggered by a call to defaultStart(). When some implemetation
provides the custom implemetation of start() method
(e.g. TerminalImpl), the doDefaultStart() may stay unimplemented
(won't be called).

Rename WrongFileNameFailure to WrongCommandFailure, as that's
being used also in case when command arguments parsing failed.

Cleanup some unimplemented or unused fields of ProcessLauncherImpl.

Change-Id: I87661e9838dc30888034b2fa62d47c861bf8f9dd
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2022-02-16 01:48:40 +01:00
parent d06449d1a5
commit aa3166df78
2 changed files with 132 additions and 123 deletions

View File

@@ -282,9 +282,7 @@ public:
virtual QByteArray readAllStandardOutput() = 0;
virtual QByteArray readAllStandardError() = 0;
virtual void start(const QString &program, const QStringList &arguments) = 0;
virtual void customStart() { QTC_CHECK(false); }
virtual bool isCustomStart() const { return false; }
virtual void start() { defaultStart(); }
virtual void terminate() = 0;
virtual void kill() = 0;
virtual void close() = 0;
@@ -315,6 +313,15 @@ signals:
void errorOccurred(QProcess::ProcessError error);
void readyReadStandardOutput();
void readyReadStandardError();
protected:
void defaultStart();
private:
virtual void doDefaultStart(const QString &program, const QStringList &arguments)
{ Q_UNUSED(program) Q_UNUSED(arguments) QTC_CHECK(false); }
bool dissolveCommand(QString *program, QStringList *arguments);
bool ensureProgramExists(const QString &program);
};