Commit Graph

25 Commits

Author SHA1 Message Date
Orgad Shaneh
e20aa431ed ShellCommand: Apply progress parser also to stderr
It is only used for Rebasing message in Git, which was moved from
stdout to stderr on Git 2.12.

Change-Id: I761cb7ac4e0d19fc28b323076dd3b0919535ed32
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-10-04 07:50:34 +00:00
Eike Ziller
c4b5048836 ShellCommand: Show some progress information without progress parser
Show magically timed progress when running a shell command without a
progress parser. The assumption is that the timeout is much larger than
the expected runtime, but still an indicator for how long it might take.
Progress manager does its magic on top of that.

This is e.g. used for the update info plugin, for which checking for
updates might take quite some while.

Change-Id: Ib3d3d37b86fac17816fe592e39e26a3d484bba26
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-07 11:24:33 +00:00
Tobias Hunger
ad2b968e4c ShellCommand: Fix crash with OutputProxy use
Pass a shared pointer into runSynchronous and runFullySynchronous.
That way the proxy will stay around for as long as needed.

Task-number: QTCREATORBUG-16612
Change-Id: Ic529440c81d85149abd67e5eeb564cc5f12181ab
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-07-18 12:06:12 +00:00
Tobias Hunger
b851b57ea3 Utils::ShellCommand: Force fully synchronous execution from UI thread
Force runCommand when run from the UI thread to do fully synchronous
operations. This prevents two event loops in one thread with (sometimes)
interesting side effects.

This also stops signals from being sent while the process is running,
but the remaining users seem to be able to handle that.

Change-Id: Id5eb9868b660419987730c60e3fbfb4cbced1218
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-07-15 14:49:02 +00:00
Tobias Hunger
2c5095c94d Utils::ShellCommand: Use SynchronousProcess where posssible
Use SynchronousProcess::run and SynchronousProcess::runBlocking.

Using SynchronousProcess::run in ShellCommand::runSynchronous
is generally safe, since this method is usually called in its
own thread. This makes the processing of cancel requests work
again and makes output available via signals.

Task-number: QTCREATORBUG-16532
Change-Id: I6907194bd00cd5713673d9b1911978d69b996a80
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-07-15 14:24:05 +00:00
Tobias Hunger
d1be129abe Utils::ShellCommand: Add runSynchronous method
Add runSynchronous method and move code from runCommand there.

Change-Id: Ic7c452d583fd88468fc6466a683159ecd8328b48
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-07-15 14:22:39 +00:00
Tobias Hunger
c2075f6a73 ShellCommand: Pass OutputProxy to runFullySynchronous
No need to create a fresh one.

Change-Id: I3c7b92319ab43030620428987dfa254be7ac03a7
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-07-15 14:22:02 +00:00
Tobias Hunger
53c602633c Utils::ShellCommand: Rename runSynchronous to runFullySynchronous
This name just got free, so use it for the method that actually is
called if the process runs with the FullySynchronously flag set.

Change-Id: Ic86bb291d578ad06b74db1ab89a22b1b8cb4f4bb
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-07-15 14:21:40 +00:00
Tobias Hunger
cc27125092 Utils::Shellcommand: Remove runFullySynchronous
Nobody uses that anymore.

Change-Id: I24935ac8d25eb639eb253250749750993c740516
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-07-15 14:21:21 +00:00
Tobias Hunger
5efd82468b SynchronousProcess: Store raw bytes from stdout/stderr of the process
Only convert the raw output later in a stdOut() and stdErr() method of
the SynchronousProcessResponse.

This is necessary since we have processes that use different encodings
for different sections of the file (I am looking at you, git).

Also remove the signals for raw data on stdout/stderr, leaving only the
signals returning buffered QString lines. This should be safe, even
with UTF-16 output.

Change-Id: Ida613fa86d1468cbd33bc6b3a1506a849c2d1c0a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-07-15 14:16:03 +00:00
Tobias Hunger
d5dc6f7f70 Utils: Use runBlocking in shellcommand
This is run in a background thread, so there is no need to keep the UI
alive.

Change-Id: I81267b918ef2350a180b0a8ee55244feca2406b4
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-06-24 08:14:32 +00:00
Orgad Shaneh
05966ab153 Utils: Suppress progress bar when "Suppress command logging" is enabled
Change-Id: I6c94352f0c816920c4b97801da050bf14ea7be66
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-05-09 07:40:14 +00:00
Eike Ziller
967177d3d8 SynchronousProcess: Change exit code interpreter to function object
Change-Id: Ic48d4f5810f171c070f0980581fb6e45f6fe6b4a
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-04-27 08:48:32 +00:00
Orgad Shaneh
f07a309129 Utils: Modernize ShellCommand and SynchronousProcess
* Reorder members to avoid padding
* Use C++11 member initialization

Change-Id: Ib04c2d59dfcf54f5df7afddc6e21197f1095e829
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-04-01 08:35:25 +00:00
Eike Ziller
dd7915acfe ShellCommand: Add missing include
It was included only by another included header.

Change-Id: Idff745a7d811c7fe0c4c791eeda884bcd4a62d98
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-02-12 13:43:28 +00:00
Eike Ziller
72af6b7834 runAsync: Remove ResultType template parameter.
It is now deduced from either the type of the
QFutureInterface<ResultType> function argument, or the return type.

Change-Id: Iddab3cc329206c649a6e55a44b2de2d406701dee
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-02-10 10:58:55 +00:00
Orgad Shaneh
9a723a0c98 Utils: Fix indentation in ShellCommand
Change-Id: Ia93d5f50c4ea1e130ddfafe763fe0bd5cc95fad1
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-02-05 11:55:39 +00:00
Eike Ziller
40fd545bf6 ShellCommand: Cleanup includes
Change-Id: I87ccf8bed5a09bcd0f8572aa3999fbbf1a1db2b4
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-01-30 16:54:35 +00:00
Eike Ziller
4659f2caca ShellCommand: Some tweaks of QtConcurrent usage
Use Utils::runAsync to avoid use of global thread pool. Move watcher
connect to constructor. Report "failure" of the command by internally
canceling.

Change-Id: Ib7616734176be2ad9356162724ca06cfd8821e52
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-01-26 10:27:09 +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
Tobias Hunger
3652ca52bc ShellCommand: Do not crash when no binary is given
Task-number: QTCREATORBUG-14643
Change-Id: I9c62904c271e2c2a94785dd8223b60d588da822b
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
2015-06-30 14:58:02 +00:00
Tobias Hunger
f2be797696 ShellCommand: Allow setting working directory per job
Change-Id: I6d541f87b76bdc7f1503f202792079f833e8932c
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-06-10 13:04:42 +00:00
Tobias Hunger
ea476ffc39 ShellCommand: Store workingdirectory in the jobs
Not all jobs of one command can run in the same directory, so
prepare for having individual working directories per job.

Change-Id: Ice43361fe54f2b7153ccd38435f6108d83570082
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-06-10 12:05:31 +00:00
Tobias Hunger
a44c403b5f ShellCommand: Rename some signals
Rename the signals used to report stdout/stderr to make it clearer
what they actually do. Remove some unimplemented private member
functions while at it.

Change-Id: I7e856f906ccb45964f3b1b64336d4d8ebca7b9ee
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-05-07 13:07:14 +00:00
Tobias Hunger
eec0a03212 Vcs: Split up VcsCommand
Move the biggest chunk into Utils::ShellCommand, add some Qt Creator
specific magic in Core::ShellCommand and leave the rest in
VcsBase::VcsCommand.

Change-Id: I5fe6f7076e96023ad2164bcfaacfb3b65a7ff8a8
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-05-04 15:27:25 +00:00