summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qprocess.h
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-02-07 14:12:57 +0100
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-02-13 19:57:47 +0100
commit92eea633491ce8138c5caceb904ad26c1eb91044 (patch)
treee102cf2d21bd9a8f730d440f6b6e8fd0a1fa7cb5 /src/corelib/io/qprocess.h
parentadfd0914e3fe9a15f818b0979936d5f0ff545f32 (diff)
Obsolete command-string parsing QProcess::start/execute overloads
The command string parsing covers only simple quoting patterns, while users tend to expect something that is in line with their shell. The overloads that take a QStringList are the recommended APIs to use anyway, so exposing the splitting method as a static function for which we document the exact behavior allows callers to post-process the QStringList, before calling the preferred overloads. [ChangeLog][QtCore][QProcess] Overloads of start/execute/startDatached that parse a single command string into program and arguments have been marked as deprecated. A static helper splitCommand has been added to construct a QStringList from a command string. Change-Id: Ie91fcfb5eae6a52e5065efc60d2d9e068d20869d Fixes: QTBUG-80640 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'src/corelib/io/qprocess.h')
-rw-r--r--src/corelib/io/qprocess.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h
index 585508adf1..504b4a8061 100644
--- a/src/corelib/io/qprocess.h
+++ b/src/corelib/io/qprocess.h
@@ -160,8 +160,14 @@ public:
void start(const QString &program, const QStringList &arguments, OpenMode mode = ReadWrite);
#if !defined(QT_NO_PROCESS_COMBINED_ARGUMENT_START)
+#if QT_DEPRECATED_SINCE(5, 15)
+ QT_DEPRECATED_X(
+ "Use QProcess::start(const QString &program, const QStringList &arguments,"
+ "OpenMode mode = ReadWrite) instead"
+ )
void start(const QString &command, OpenMode mode = ReadWrite);
#endif
+#endif
void start(OpenMode mode = ReadWrite);
bool startDetached(qint64 *pid = nullptr);
bool open(OpenMode mode = ReadWrite) override;
@@ -250,8 +256,12 @@ public:
bool atEnd() const override; // ### Qt6: remove trivial override
static int execute(const QString &program, const QStringList &arguments);
+#if QT_DEPRECATED_SINCE(5, 15)
+ QT_DEPRECATED_X(
+ "Use QProcess::execute(const QString &program, const QStringList &arguments) instead"
+ )
static int execute(const QString &command);
-
+#endif
static bool startDetached(const QString &program, const QStringList &arguments,
const QString &workingDirectory
#if defined(Q_QDOC)
@@ -261,12 +271,19 @@ public:
#if !defined(Q_QDOC)
static bool startDetached(const QString &program, const QStringList &arguments); // ### Qt6: merge overloads
#endif
+#if QT_DEPRECATED_SINCE(5, 15)
+ QT_DEPRECATED_X(
+ "Use QProcess::startDetached(const QString &program, const QStringList &arguments) instead"
+ )
static bool startDetached(const QString &command);
+#endif
static QStringList systemEnvironment();
static QString nullDevice();
+ static QStringList splitCommand(const QString &command);
+
public Q_SLOTS:
void terminate();
void kill();