aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/api/runenvironment.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@theqtcompany.com>2016-04-04 13:20:24 +0200
committerChristian Kandeler <christian.kandeler@theqtcompany.com>2016-04-07 08:38:23 +0000
commitbc5ef731d64edd6d2f152a7c68b6ad46efd7066c (patch)
tree9bdbb644724505e478c68499181f138df004313c /src/lib/corelib/api/runenvironment.cpp
parentad78ab0bd362c79b58ebb44dfd0646f49027bb37 (diff)
Do not throw exceptions from the RunEnvironment class.
Apparently, this class was overlooked when we made the API non-throwing (or it was internal at the time). Task-number: QBS-952 Change-Id: I445436c1ddb3d815a20f44a87438b3cdbccfc156 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'src/lib/corelib/api/runenvironment.cpp')
-rw-r--r--src/lib/corelib/api/runenvironment.cpp53
1 files changed, 49 insertions, 4 deletions
diff --git a/src/lib/corelib/api/runenvironment.cpp b/src/lib/corelib/api/runenvironment.cpp
index e0f0a0c91..aee7aa31a 100644
--- a/src/lib/corelib/api/runenvironment.cpp
+++ b/src/lib/corelib/api/runenvironment.cpp
@@ -92,7 +92,52 @@ RunEnvironment::~RunEnvironment()
delete d;
}
-int RunEnvironment::runShell()
+int RunEnvironment::runShell(ErrorInfo *error)
+{
+ try {
+ return doRunShell();
+ } catch (const ErrorInfo &e) {
+ if (error)
+ *error = e;
+ return -1;
+ }
+}
+
+int RunEnvironment::runTarget(const QString &targetBin, const QStringList &arguments,
+ ErrorInfo *error)
+{
+ try {
+ return doRunTarget(targetBin, arguments);
+ } catch (const ErrorInfo &e) {
+ if (error)
+ *error = e;
+ return -1;
+ }
+}
+
+const QProcessEnvironment RunEnvironment::runEnvironment(ErrorInfo *error) const
+{
+ try {
+ return getRunEnvironment();
+ } catch (const ErrorInfo &e) {
+ if (error)
+ *error = e;
+ return QProcessEnvironment();
+ }
+}
+
+const QProcessEnvironment RunEnvironment::buildEnvironment(ErrorInfo *error) const
+{
+ try {
+ return getBuildEnvironment();
+ } catch (const ErrorInfo &e) {
+ if (error)
+ *error = e;
+ return QProcessEnvironment();
+ }
+}
+
+int RunEnvironment::doRunShell()
{
d->resolvedProduct->setupBuildEnvironment(&d->engine, d->environment);
@@ -156,7 +201,7 @@ static QString findExecutable(const QStringList &fileNames)
return QString();
}
-int RunEnvironment::runTarget(const QString &targetBin, const QStringList &arguments)
+int RunEnvironment::doRunTarget(const QString &targetBin, const QStringList &arguments)
{
const QStringList targetOS = PropertyFinder().propertyValue(
d->resolvedProduct->moduleProperties->value(),
@@ -287,13 +332,13 @@ int RunEnvironment::runTarget(const QString &targetBin, const QStringList &argum
return process.exitCode();
}
-const QProcessEnvironment RunEnvironment::runEnvironment() const
+const QProcessEnvironment RunEnvironment::getRunEnvironment() const
{
d->resolvedProduct->setupRunEnvironment(&d->engine, d->environment);
return d->resolvedProduct->runEnvironment;
}
-const QProcessEnvironment RunEnvironment::buildEnvironment() const
+const QProcessEnvironment RunEnvironment::getBuildEnvironment() const
{
d->resolvedProduct->setupBuildEnvironment(&d->engine, d->environment);
return d->resolvedProduct->buildEnvironment;