Fix when the name of a process called with sudo is not shown

Summary:

Any process that is called in foreground with sudo (ex: sudo qtcreator) is identified by ProcessInfo::name only with the word sudo, being unable to identify which process it is. This fix makes it shows sudo along with the name of the process called.

Reviewers: #konsole, hindenburg
Reviewed by: #konsole, hindenburg

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D12754
This commit is contained in:
Caio Carvalho
2018-05-12 14:44:23 -03:00
parent 17cb78cee1
commit 90b96b695f

View File

@@ -365,6 +365,17 @@ void UnixProcessInfo::readProcessInfo(int pid)
if (readProcInfo(pid)) {
readArguments(pid);
readCurrentDir(pid);
bool ok = false;
const QString &processNameString = name(&ok);
if (ok && processNameString == QLatin1String("sudo")) {
//Append process name along with sudo
const QVector<QString> &args = arguments(&ok);
if (ok && args.size() > 1)
setName(processNameString + QStringLiteral(" ") + args[1]);
}
}
}