Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Akonadi
Commits
7b411190
Commit
7b411190
authored
Feb 03, 2022
by
Laurent Montel
Browse files
Check executables exist in PATH before passing them to QProcess
parent
563b110d
Pipeline
#132234
passed with stage
in 5 minutes and 7 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/akonadictl/akonadistarter.cpp
View file @
7b411190
...
...
@@ -15,6 +15,7 @@
#include
<QCoreApplication>
#include
<QDBusConnection>
#include
<QProcess>
#include
<QStandardPaths>
#include
<QTimer>
#include
<iostream>
...
...
@@ -41,8 +42,8 @@ bool AkonadiStarter::start(bool verbose)
serverArgs
<<
QStringLiteral
(
"--verbose"
);
}
const
bool
ok
=
QProcess
::
startDetached
(
QStringLiteral
(
"akonadi_control"
)
,
serverArgs
);
if
(
!
ok
)
{
const
QString
exec
=
QStandardPaths
::
findExecutable
(
QStringLiteral
(
"akonadi_control"
));
if
(
exec
.
isEmpty
()
||
!
QProcess
::
startDetached
(
QStringLiteral
(
"akonadi_control"
),
serverArgs
)
)
{
std
::
cerr
<<
"Error: unable to execute binary akonadi_control"
<<
std
::
endl
;
return
false
;
}
...
...
src/core/servermanager.cpp
View file @
7b411190
...
...
@@ -31,6 +31,7 @@
#include
<QDBusServiceWatcher>
#include
<QProcess>
#include
<QScopedPointer>
#include
<QStandardPaths>
#include
<QTimer>
#include
<qnamespace.h>
...
...
@@ -207,8 +208,8 @@ bool ServerManager::start()
if
(
hasInstanceIdentifier
())
{
args
<<
QStringLiteral
(
"--instance"
)
<<
instanceIdentifier
();
}
const
bool
ok
=
QProcess
::
startDetached
(
QStringLiteral
(
"akonadi_control"
)
,
args
);
if
(
!
ok
)
{
const
QString
exec
=
QStandardPaths
::
findExecutable
(
QStringLiteral
(
"akonadi_control"
));
if
(
exec
.
isEmpty
()
||
!
QProcess
::
startDetached
(
QStringLiteral
(
"akonadi_control"
),
args
)
)
{
qCWarning
(
AKONADICORE_LOG
)
<<
"Unable to execute akonadi_control, falling back to D-Bus auto-launch"
;
QDBusReply
<
void
>
reply
=
QDBusConnection
::
sessionBus
().
interface
()
->
startService
(
ServerManager
::
serviceName
(
ServerManager
::
Control
));
if
(
!
reply
.
isValid
())
{
...
...
@@ -236,7 +237,10 @@ bool ServerManager::stop()
void
ServerManager
::
showSelfTestDialog
(
QWidget
*
parent
)
{
Q_UNUSED
(
parent
)
QProcess
::
startDetached
(
QStringLiteral
(
"akonadiselftest"
),
QStringList
());
const
QString
exec
=
QStandardPaths
::
findExecutable
(
QStringLiteral
(
"akonadiselftest"
));
if
(
exec
.
isEmpty
()
||
!
QProcess
::
startDetached
(
QStringLiteral
(
"akonadiselftest"
),
QStringList
()))
{
qCWarning
(
AKONADICORE_LOG
)
<<
"Could not find akonadiselftest in PATH."
;
}
}
bool
ServerManager
::
isRunning
()
...
...
Laurent Montel
@mlaurent
mentioned in commit
191dfe9a
·
Feb 03, 2022
mentioned in commit
191dfe9a
mentioned in commit 191dfe9afac9a4495d0a65f2f9cad88f2f58671d
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment