Commit Graph

100 Commits

Author SHA1 Message Date
hjk
f2f40efa03 Utils: Move process arguments class out of QtcProcess
The main QtcProcess interface is nowadays a CommandLine, with no
explicit references left to QtcProcess::Arguments and related static
helper functions, so it only clutters the QtcProcess class interface

So move these items out of QtcProcess, later potentially to a separate
file pair.

Change-Id: I45c300b656f5b30e2e2717232c855fdd97c2d1d7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-11 09:45:24 +00:00
hjk
8aafe36d01 Utils: Inline QtcProcessPrivate::processStd{Out,Err}
Less indirection.

Change-Id: Iff05c36b20d046a08725ebcb3c03931b6fd8aeab
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-11 07:40:47 +00:00
hjk
cad7671da0 Utils: Move most of SynchronousProcess to QtcProcess
Merge the pimpls, move the remaining functions to the base.

This leaves SynchronousProcess as a QtcProcess with an internal
special setup. Plan is still to unify this completely.

Change-Id: Ie95d35ace23a1b7e078174ea37b9fd70a3ebe178
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-05-11 07:33:54 +00:00
hjk
a4b5479695 Utils: Base SynchronousProcess on QtcProcess
This is the last intermediate step before unification to keep the
merge small.

Change-Id: I5b320f9db4c467c49a384f665cea5e16bfef4f60
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-11 06:34:17 +00:00
hjk
771f1ef6d6 Utils: Rename SychronousProcess::terminate to stopProcess
To align with QtcProcess.

Change-Id: I02e739b55ec95d5f516037de38b4f6228859809f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-10 11:47:40 +00:00
hjk
d825805c39 Utils: Use std::function instead of signal SynchronousProcess callback
Simpler interface and use.

Change-Id: I8db448b7ccd12927b8f8fd347b0a92c3f76f7114
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2021-05-10 11:40:25 +00:00
hjk
c23cdd9262 Utils: Merge {synchronous,qtc}process.{h,cpp} file pairs
Mechanical to prepare merging the actual classes.
Adapting #includes.

Change-Id: I77a2c28129287778bc870c30cb890cd26bc2e62b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-10 09:47:51 +00:00
hjk
e9abd60732 Utils: Pimpl QtcProcess
Change-Id: I51d68ad760c181bfcedcd73d216a0535479ba39f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-10 07:38:53 +00:00
hjk
6f53022a11 Utils: Merge TerminalControllingProcess into QtcProcess
Effectively only a single flag controlling a call to setsid().

Change-Id: I6a2be35df1bddc81702575678ee3a065a71cecf5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-10 07:38:42 +00:00
hjk
2c70ad63d1 Utils: Move SynchronousProcess::locateBinary to QtcProcess
Change-Id: I1df5008f8f33d25f208ab8be13b4a6e72c901be2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-07 12:47:38 +00:00
hjk
e10b5a4dbb Utils: Remove SynchronousProcess::readDataFromProcess helper
QtcProcess can do that nowadays.

Change-Id: Ic3b08146263da2eb189f043eb743c621c18b82c8
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-07 12:42:18 +00:00
hjk
dec9169efe Utils: Move SynchronousProcess::normalizeNewlines to QtcProcess
Change-Id: I5ba8ba1061b04b032aafd08382d34ccb62272829
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-04 07:19:55 +00:00
hjk
ecc5c042ab Utils: Shift more code from SynchronousProcess to QtcProcess
Copy for now, original will vanish once all is ported.

Idea is still to reduce the number of process related classes.

To avoid a new dependency for qmlpuppet, handle questions to
the user only inside #ifdef.

Change-Id: Ib1354fc0370a87052b4f9c8460dfcf5d762a6c4e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-05-03 11:47:34 +00:00
Cristian Adam
7880950eca PCH build fix when building with Clang 12
Clang 12 has added a template parameter as "CALLBACK",
which conflicts with the Windows "CALLBACK" define.

Change-Id: I773899d103dcb1a852b555a1900b2de4acb6d96f
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-05-02 11:38:01 +00:00
hjk
dcba96d16e Utils: Copy some SynchronousProcess function to QtcProcess
Start using it in Utils::Archive.

The idea is to merge SynchronousProcess into QtcProcess (or avoid its
use) to have fewer classes to make "remote-aware".

Change-Id: Ieb08f6f66eab63fd058b75e3bafa79bfbf140387
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-04-30 09:16:28 +00:00
hjk
fe8fbf1a4a Utils: Add a synchronous property to QtcProcess interface
Use it to avoid IDevice interface clutter.

Change-Id: I4a04f04e2c343593d937a402060e56ef94fcabf1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-04-30 09:16:12 +00:00
hjk
fa23183460 QtcProcess: Prepare for implementation some remote functions
Change-Id: I3c3d7d2288b5b607a2c3e933806e2e922c04610f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-04-28 10:45:25 +00:00
Eike Ziller
8527cbedcc Fix more compilation issues with Qt6
Various Windows related issues and issues with additional QML designer
components.
Don't use very generic template definitions if the type has to provide
not so generic base functionality (in this case providing a stream
operator for QDataStream).

Task-number: QTCREATORBUG-24098
Change-Id: Id0729c249d1b81e4e939fdaeb2e02b8a64e7e8f9
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-11-04 12:52:17 +00:00
Eike Ziller
430a9a03b7 Utils: Add workaround for sdktool
Which is compiled against an older Qt version to keep it more
compatible.

Change-Id: Ifee61a524055ca383c83da9f237e50536a3fd0cb
Reviewed-by: hjk <hjk@qt.io>
2020-10-06 06:14:53 +00:00
Eike Ziller
3433b8c24f Qt6: Adapt to removal of QProcess::setupChildProcess
And use QProcess::setChildProcessModifier when compiling against Qt6.

Task-number: QTCREATORBUG-24098
Change-Id: I4166a8e27f8f63dd661df119413cd2eb2ae1dc2e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-10-02 07:25:10 +00:00
hjk
361b5e3530 Utils: Determine shell from $SHELL instead of hard-coding /bin/sh
Fixes: QTCREATORBUG-24659
Change-Id: Icafc001b681cc76af76b8759a4de84db51146fd4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-09-23 15:55:55 +00:00
Eike Ziller
7e8c3e91a1 Utils: Fix build with Qt6
Do not use QStringRef related API, replace with QStringView where
appropriate.

Adapt to removal of QAbstractItemView::viewOptions().

Task-number: QTCREATORBUG-24098
Change-Id: I5a7a9821984583222083733f91b46df39c21d592
Reviewed-by: hjk <hjk@qt.io>
2020-09-07 09:07:57 +00:00
Orgad Shaneh
51453936cc Utils: Replace foreach with range-based for
Change-Id: I9aeea9c029ffc56cbadc04edd20e9b35b154f986
Reviewed-by: hjk <hjk@qt.io>
2020-06-16 04:43:29 +00:00
hjk
cbac89b0fd QtcProcess: Port to QRegularExpression
Task-number: QTCREATORBUG-24098
Change-Id: I9784989786ff65ceac6c9921f7f9f09d4e0f0a49
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-15 05:27:59 +00:00
hjk
f2e06d2764 Revert "Port to Qt 6's absence of QProcess::setupChildProcess"
This reverts commit 6a66ced594.

The patch that will introduce the alternative to setupChildProcess
(QProcess::setChildProcessModifier()) has not yet found its
way to qtbase and current Qt dev already identifies itself as
version 6.0.0, rendering the code here uncompilable.

Change-Id: I570b01598005070f0c17604226d245a3a381250e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-06-11 13:17:00 +00:00
Thiago Macieira
6a66ced594 Port to Qt 6's absence of QProcess::setupChildProcess
Change-Id: I9709abb1c3734e10a7defffd1607e5b3fd46af0e
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-04-30 15:38:41 +00:00
Thiago Macieira
86fae567fa TerminalControllingProcess: don't use qWarning in the child process
qWarning() and all of QMessageLogger will get to qFormatLogMessage(),
which locks a mutex. Additionally, qWarning may call a number of
different backends that, in turn, may have mutexes of their own. Locking
mutexes in child processes between fork() and execve() is a big no-no:
it may have been locked by another thread before fork(), so it's still
locked in the child process and will never get unlocked. Result:
deadlock.

Plus, qWarning reacts to QT_FATAL_WARNINGS, which I guess was not
intended for this class.

So just use a plain perror(), which is guaranteed by POSIX to be
"MT-Safe race:stderr".

Change-Id: I4e559af2a9a1455ab770fffd15f4a37a3fd113ca
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-02-20 12:53:00 +00:00
Alessandro Portale
24a25eed14 Use isEmpty() instead of count() or size()
Change-Id: I0a89d2808c6d041da0dc41ea5aea58e6e8759bb4
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-01-20 20:56:57 +00:00
Orgad Shaneh
e38361b5a8 Lower priority on build
This should prevent slowdown of the IDE (and the rest of the system) while
building with all the CPU cores.

Fixes: QTCREATORBUG-5155
Change-Id: Icaadc53958f2d8e918035463e3c9344c91235615
Reviewed-by: hjk <hjk@qt.io>
2019-09-18 09:35:39 +00:00
Christian Kandeler
6d3f236aab Utils::Environment: Use expanded values
The Environment class is supposed to support values with references to
other variables, but we failed to actually expand them in most places.

Fixes: QTCREATORBUG-22687
Change-Id: I108cb59d3b4571471423455240f6f4f1cf64bf05
Reviewed-by: hjk <hjk@qt.io>
2019-08-20 12:39:16 +00:00
hjk
251287f0d3 Avoid warning on empty expressions
For some reason, Q_UNUSED includes already a semicolon, adding one
on the user side creates an additional empty statement.

Change-Id: I9c5e8fac381345a60792cb75e2938fd53958d3b0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-07-23 11:55:59 +00:00
Christian Kandeler
acfe45c434 SSH: Fix running remote process in terminal
ConsoleProcess stumbles over the special characters in the remote
command and as a result silently runs the command locally instead.
Prevent that. We can (and should) simply leave these characters alone,
as they have no special meaning on the local machine.

Change-Id: I31b3afe1cf170e51d431372b15f4df3656006959
Reviewed-by: hjk <hjk@qt.io>
2019-06-14 12:18:48 +00:00
hjk
959fec76dc Utils: Move CommandLine to fileutils.{cpp,h}
Causes less #include hassle when using downstream instead of
command/argument pairs.

Change-Id: I0fa0d016374df0b8e0a22f3786623652af684d36
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-06-03 12:32:07 +00:00
hjk
a7345b67c1 ProjectExplorer/Android: Some more use of Utils::CommandLine
And surrounding cosmetics.

Change-Id: Iad3d2d43856b1fcd9530d4a209fff9887e6cec42
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-29 16:49:47 +00:00
hjk
0e0a8e9204 WinRt: Use new Utils::CommandLine
Change-Id: I7320f92199af439225233b6a1bcf0ec0b185cdcb
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-29 14:43:36 +00:00
hjk
4098be05b2 Utils: Extract a CommandLine structure from a QtcProcess
We regularly pass around strings or filenames or pairs of strings
or filenames and stringlist etc the in the end will be used
as a kind of "command line", with quite a bit of ad-hoc user
code and QtcProcess::addArg etc to set them up and manipulate them.

Let's have a class for that concept.

Change-Id: I288ab939d853b32c717135a65242c584c2beab50
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-29 14:36:46 +00:00
Alessandro Portale
f6943a712a Utils: Modernize further
Many issues, mostly in headers, were not addressed in
e38410b76c

modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using
modernize-use-default-member-init
modernize-use-equals-default

Change-Id: I320a51726db881e582b898948d53735ebb06887a
Reviewed-by: hjk <hjk@qt.io>
2018-07-24 12:21:42 +00:00
Nikita Baryshnikov
e4c3e04ebd Environment: make usage of Environment.iterators more consistent
Change-Id: I114ddb2238ad19ac0681b8405925f283f2460f21
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-28 08:59:55 +00:00
Montel Laurent
158ab3316e Use QString::*Ref method
Change-Id: I63a10f274dd17e08b5b8a2577762cc9f7960b5af
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-04-21 12:04:38 +00:00
Orgad Shaneh
da7cb91446 Merge remote-tracking branch 'origin/4.2' into 4.3
Change-Id: I4931dcc81be872d7712e67123e94d15ee696459f
2017-03-14 16:20:14 +02:00
Samuel Gaist
4033471aa9 QRegExp include cleanup
This patch adds the missing include statements for QRegExp.

Change-Id: Ibb03b929940adb84ae190b5090cb6b88653cc14c
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2017-03-13 22:05:30 +00:00
Tim Jenssen
2631ffabd5 Remove spaces in initializer lists
Format initializer lists code style like.

Change-Id: Ib82c235e4ba7dc75ee96a7abc0c47eff7b0a9013
Reviewed-by: hjk <hjk@qt.io>
2017-02-22 16:25:09 +00:00
Christian Stenger
e952b9d4f3 Replace occurrences of QStringList() << pattern
Change-Id: I598d8c06193c2e72435a76165d1afc9ee3465b48
Reviewed-by: hjk <hjk@qt.io>
2017-02-09 13:17:49 +00:00
Orgad Shaneh
a6c17fc537 Remove all QT_VERSION_CHECK
We only support Qt 5.6 now.

Change-Id: If94864400545b057623e3af0743c55ea1e84e33b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2016-08-12 13:29:58 +00:00
Orgad Shaneh
5bc8d10baa Remove uses of deprecated QProcess::error signal
This overload of error is deprecated in 5.6.

Replace with errorOccurred, which was introduced in 5.6.

Change-Id: Iccfba7e7103b7ce377471696f1f2ec217e52c840
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2016-08-09 16:02:43 +00:00
Ulf Hermann
dd4e185eb3 Utils: Register metatypes for QProcess enums
Apparently they aren't automatically registered on Qt 5.5

Change-Id: I0932cc7c5f56019300380ebb905d67d99eb8e9d0
Reviewed-by: hjk <hjk@theqtcompany.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-06-08 11:44:23 +00:00
hjk
bebdad0df1 Utils: Adapt to QChar changes.
Less warnings.

Change-Id: I435abb1f39d179be10e4d0446b352f2ff7636437
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2016-05-18 11:13:30 +00:00
Tobias Hunger
f72370f20a Update License according to agreement with Free Qt Foundation
* Update remaining files in src

Change-Id: I1896f17fcf34f71c3310c87899fb5171b8e4afb1
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-01-19 15:59:41 +00:00
Jake Petroules
46b5eefcbf Explicitly document usage of Qt bug workaround.
Task-number: QTBUG-49694
Change-Id: I4516949af78320a1cdead9bce8ac90fe2ddc7fa9
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-11-30 16:18:19 +00:00
hjk
77661e378a Utils: Remove qPidToPid() adapter function
Since Qt 5.3, there's a QProcess::processId() providing direct access.

Change-Id: Ia9c143c7a92ec61d1aa36ff3f4670ba72a509634
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2015-09-16 12:08:16 +00:00