Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Network
KDE Connect
Commits
3b7d51dc
Commit
3b7d51dc
authored
May 09, 2021
by
Piyush Aggarwal
🎮
Browse files
runcommand: avoid using cmd to allow better handling of quoted arguments
parent
153bc227
Pipeline
#61199
passed with stage
in 2 minutes and 30 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
plugins/runcommand/runcommandplugin.cpp
View file @
3b7d51dc
...
...
@@ -29,16 +29,9 @@
#define PACKET_TYPE_RUNCOMMAND QStringLiteral("kdeconnect.runcommand")
#ifdef Q_OS_WIN
#define COMMAND "cmd"
#define ARGS "/c"
#else
#define COMMAND "/bin/sh"
#define ARGS "-c"
#endif
K_PLUGIN_CLASS_WITH_JSON
(
RunCommandPlugin
,
"kdeconnect_runcommand.json"
)
RunCommandPlugin
::
RunCommandPlugin
(
QObject
*
parent
,
const
QVariantList
&
args
)
...
...
@@ -68,7 +61,11 @@ bool RunCommandPlugin::receivePacket(const NetworkPacket& np)
}
const
QJsonObject
commandJson
=
value
.
toObject
();
qCInfo
(
KDECONNECT_PLUGIN_RUNCOMMAND
)
<<
"Running:"
<<
COMMAND
<<
ARGS
<<
commandJson
[
QStringLiteral
(
"command"
)].
toString
();
#ifdef Q_OS_WIN
QProcess
::
startDetached
(
commandJson
[
QStringLiteral
(
"command"
)].
toString
());
#else
QProcess
::
startDetached
(
QStringLiteral
(
COMMAND
),
QStringList
()
<<
QStringLiteral
(
ARGS
)
<<
commandJson
[
QStringLiteral
(
"command"
)].
toString
());
#endif
return
true
;
}
else
if
(
np
.
has
(
QStringLiteral
(
"setup"
)))
{
Daemon
::
instance
()
->
openConfiguration
(
device
()
->
id
(),
QStringLiteral
(
"kdeconnect_runcommand"
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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