From 90b96b695f35532d5b3235758fa4d2ef3ba345cc Mon Sep 17 00:00:00 2001 From: Caio Carvalho Date: Sat, 12 May 2018 14:44:23 -0300 Subject: [PATCH] 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 --- src/ProcessInfo.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ProcessInfo.cpp b/src/ProcessInfo.cpp index 410682b53..bb428608f 100644 --- a/src/ProcessInfo.cpp +++ b/src/ProcessInfo.cpp @@ -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 &args = arguments(&ok); + + if (ok && args.size() > 1) + setName(processNameString + QStringLiteral(" ") + args[1]); + } } }