diff --git a/src/widgets/krun.cpp b/src/widgets/krun.cpp --- a/src/widgets/krun.cpp +++ b/src/widgets/krun.cpp @@ -1750,19 +1750,24 @@ terminateStartupNotification(); // do this before the messagebox if (exitCode != 0 && !m_executable.isEmpty()) { + QString errorString; + const bool foundExec = !QStandardPaths::findExecutable(m_executable).isEmpty(); // Let's see if the error is because the exe doesn't exist. // When this happens, waitForStarted returns false, but not if kioexec // was involved, then we come here, that's why the code is here. // // We'll try to find the executable relatively to current directory, // (or with a full path, if m_executable is absolute), and then in the PATH. - if (!QFile(m_executable).exists() && QStandardPaths::findExecutable(m_executable).isEmpty()) { - const QString &errorString = i18n("Could not find the program '%1'", m_executable); - qWarning() << errorString; - emit error(errorString); - } else { - //qDebug() << process->readAllStandardError(); + if (!QFileInfo(m_executable).isExecutable() && !foundExec) { + errorString = i18n("Could not find an executable program with the name '%1'", m_executable); + } else if (foundExec) { + // We found an executable but it failed to launch for some reason + errorString = i18n("The executable '%1' terminated abnormally.\n" + "For more details try running it from a terminal emulator (e.g. Konsole).", + m_executable, exitCode); } + qWarning() << errorString; + emit error(errorString); } deleteLater(); diff --git a/src/widgets/krun_p.h b/src/widgets/krun_p.h --- a/src/widgets/krun_p.h +++ b/src/widgets/krun_p.h @@ -87,7 +87,7 @@ void error(const QString &errorString); private Q_SLOTS: - void slotProcessExited(int, QProcess::ExitStatus); + void slotProcessExited(int exitCode, QProcess::ExitStatus); private: void init(const KService::Ptr &service, const QString &bin, const QString &userVisibleName,