kdesudo: fix execution failure detection and notification

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-08-29 00:46:33 +03:00
parent 5bca600df3
commit bf041a724f

View file

@ -304,8 +304,9 @@ void KdeSudo::parseOutput()
} else {
error(i18n("Wrong password! Exiting..."));
}
} else if (strOut.contains("command not found")) {
// NOTE: "command not found" comes from `sudo` while "No such file or directory" comes from
// either `nice` or `dbus-run-session`
} else if (strOut.contains("command not found") || strOut.contains("No such file or directory")) {
error(i18n("Command not found!"));
} else if (strOut.contains("is not in the sudoers file")) {
error(i18n("Your username is unknown to sudo!"));
@ -330,8 +331,8 @@ void KdeSudo::procExited(int exitCode)
if (!m_tmpName.isEmpty()) {
QFile::remove(m_tmpName);
}
KApplication::kApplication()->exit(exitCode);
}
KApplication::kApplication()->exit(exitCode);
}
void KdeSudo::pushPassword(const QString &pwd)