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
Plasma
Plasma Workspace
Commits
2452e658
Commit
2452e658
authored
Nov 07, 2020
by
Alexander Lohnau
💬
Browse files
Fix edge case for tilde and ENV command
parent
97bc72b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
runners/shell/shellrunner.cpp
View file @
2452e658
...
...
@@ -55,7 +55,7 @@ void ShellRunner::match(Plasma::RunnerContext &context)
{
bool
isShellCommand
=
context
.
type
()
==
Plasma
::
RunnerContext
::
ShellCommand
||
context
.
type
()
==
Plasma
::
RunnerContext
::
Executable
;
QStringList
envs
;
QString
command
;
QString
command
=
context
.
query
()
;
// If it is not a shell command we check if we use ENV variables, FEATURE: 409107
// This is not recognized when setting the context type and we can't change it, because
// other runners depend on the current pattern
...
...
@@ -84,7 +84,7 @@ void ShellRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryM
return
;
}
auto
*
job
=
new
KIO
::
CommandLauncherJob
(
context
.
query
());
auto
*
job
=
new
KIO
::
CommandLauncherJob
(
context
.
query
());
// The job can handle the env parameters
job
->
setUiDelegate
(
new
KNotificationJobUiDelegate
(
KJobUiDelegate
::
AutoHandlingEnabled
));
job
->
start
();
}
...
...
@@ -94,7 +94,7 @@ bool ShellRunner::parseENVVariables(const QString &query, QStringList &envs, QSt
const
static
QRegularExpression
envRegex
=
QRegularExpression
(
QStringLiteral
(
"^.+=.+$"
));
const
QStringList
split
=
KShell
::
splitArgs
(
query
);
for
(
const
auto
&
entry
:
split
)
{
if
(
!
QStandardPaths
::
findExecutable
(
entry
).
isEmpty
())
{
if
(
!
QStandardPaths
::
findExecutable
(
KShell
::
tildeExpand
(
entry
)
)
.
isEmpty
())
{
command
=
KShell
::
joinArgs
(
split
.
mid
(
split
.
indexOf
(
entry
)));
return
true
;
}
else
if
(
envRegex
.
match
(
entry
).
hasMatch
())
{
...
...
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