Commit cc91a6c4 authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

Fix edge case for tilde and ENV command

parent 2e268a1b
......@@ -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
......@@ -83,7 +83,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();
}
......@@ -100,7 +100,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()) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment