diff options
author | hjk <hjk@qt.io> | 2019-07-23 12:39:05 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2019-07-23 16:03:02 +0000 |
commit | fa81f76237ea29c8e38c913f94ef36bbe6bf42b8 (patch) | |
tree | 46907dcd2161c95e5018c3c58a22c44d2c9cf070 | |
parent | 8b72e9216746c04e68a1c6498ac3396942fbebce (diff) | |
download | qt-creator-fa81f76237ea29c8e38c913f94ef36bbe6bf42b8.tar.gz |
Utils: Move meta char policy handling from FilePath to ConsoleProcess
Currently the only place that's using it and the scope is much smaller.
Change-Id: I1a43d14f0e2c69a16f76e6f83b82436bbeeac1c9
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | src/libs/utils/consoleprocess.h | 1 | ||||
-rw-r--r-- | src/libs/utils/consoleprocess_p.h | 1 | ||||
-rw-r--r-- | src/libs/utils/consoleprocess_unix.cpp | 9 | ||||
-rw-r--r-- | src/libs/utils/fileutils.cpp | 3 | ||||
-rw-r--r-- | src/libs/utils/fileutils.h | 7 | ||||
-rw-r--r-- | src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp | 5 |
6 files changed, 13 insertions, 13 deletions
diff --git a/src/libs/utils/consoleprocess.h b/src/libs/utils/consoleprocess.h index 1ae0bb4496..57e1da3145 100644 --- a/src/libs/utils/consoleprocess.h +++ b/src/libs/utils/consoleprocess.h @@ -63,6 +63,7 @@ public: ~ConsoleProcess() override; void setCommand(const Utils::CommandLine &command); + void setAbortOnMetaChars(bool abort); void setWorkingDirectory(const QString &dir); QString workingDirectory() const; diff --git a/src/libs/utils/consoleprocess_p.h b/src/libs/utils/consoleprocess_p.h index b32be8c586..73169ad8dc 100644 --- a/src/libs/utils/consoleprocess_p.h +++ b/src/libs/utils/consoleprocess_p.h @@ -60,6 +60,7 @@ struct ConsoleProcessPrivate { QTemporaryFile *m_tempFile = nullptr; QProcess::ProcessError m_error = QProcess::UnknownError; QString m_errorString; + bool m_abortOnMetaChars = true; #ifdef Q_OS_UNIX QProcess m_process; diff --git a/src/libs/utils/consoleprocess_unix.cpp b/src/libs/utils/consoleprocess_unix.cpp index fe83b95f58..fa777f1859 100644 --- a/src/libs/utils/consoleprocess_unix.cpp +++ b/src/libs/utils/consoleprocess_unix.cpp @@ -65,6 +65,11 @@ void ConsoleProcess::setCommand(const Utils::CommandLine &command) d->m_commandLine = command; } +void ConsoleProcess::setAbortOnMetaChars(bool abort) +{ + d->m_abortOnMetaChars = abort; +} + void ConsoleProcess::setSettings(QSettings *settings) { d->m_settings = settings; @@ -84,8 +89,8 @@ bool ConsoleProcess::start() HostOsInfo::hostOs(), &d->m_environment, &d->m_workingDir, - d->m_commandLine.metaCharMode() - == CommandLine::MetaCharMode::Abort); + d->m_abortOnMetaChars); + QString pcmd; if (perr == QtcProcess::SplitOk) { pcmd = d->m_commandLine.executable().toString(); diff --git a/src/libs/utils/fileutils.cpp b/src/libs/utils/fileutils.cpp index 2f9ea09680..363697c4fb 100644 --- a/src/libs/utils/fileutils.cpp +++ b/src/libs/utils/fileutils.cpp @@ -86,9 +86,8 @@ CommandLine::CommandLine(const QString &exe, const QStringList &args) : CommandLine(FilePath::fromString(exe), args) {} -CommandLine::CommandLine(const FilePath &exe, const QStringList &args, MetaCharMode metaCharMode) +CommandLine::CommandLine(const FilePath &exe, const QStringList &args) : m_executable(exe) - , m_metaCharMode(metaCharMode) { addArgs(args); } diff --git a/src/libs/utils/fileutils.h b/src/libs/utils/fileutils.h index 4385d6f618..e1236f0f28 100644 --- a/src/libs/utils/fileutils.h +++ b/src/libs/utils/fileutils.h @@ -132,15 +132,12 @@ class QTCREATOR_UTILS_EXPORT CommandLine { public: enum RawType { Raw }; - enum class MetaCharMode { Abort, Ignore }; CommandLine() {} explicit CommandLine(const QString &executable); explicit CommandLine(const FilePath &executable); CommandLine(const QString &exe, const QStringList &args); - CommandLine(const FilePath &exe, - const QStringList &args, - MetaCharMode metaCharMode = MetaCharMode::Abort); + CommandLine(const FilePath &exe, const QStringList &args); CommandLine(const FilePath &exe, const QString &unparsedArgs, RawType); void addArg(const QString &arg, OsType osType = HostOsInfo::hostOs()); @@ -152,13 +149,11 @@ public: FilePath executable() const { return m_executable; } QString arguments() const { return m_arguments; } - MetaCharMode metaCharMode() const { return m_metaCharMode; } QStringList splitArguments(OsType osType = HostOsInfo::hostOs()) const; private: FilePath m_executable; QString m_arguments; - MetaCharMode m_metaCharMode; }; class QTCREATOR_UTILS_EXPORT FileUtils { diff --git a/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp b/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp index a73ac07483..19ca79d0c2 100644 --- a/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp +++ b/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp @@ -201,9 +201,8 @@ void SshDeviceProcess::handleConnected() this, &SshDeviceProcess::handleProcessStarted); connect(&d->consoleProcess, &ConsoleProcess::stubStopped, this, [this] { handleProcessFinished(d->consoleProcess.errorString()); }); - d->consoleProcess.setCommand({FilePath::fromString(cmdLine.first()), - cmdLine.mid(1), - CommandLine::MetaCharMode::Ignore}); + d->consoleProcess.setAbortOnMetaChars(false); + d->consoleProcess.setCommand({cmdLine.first(), cmdLine.mid(1)}); d->consoleProcess.start(); } else { connect(d->process.get(), &QSsh::SshRemoteProcess::started, |