* @brief Handles QProcess termination. */
| 504 | * @brief Handles QProcess termination. |
| 505 | */ |
| 506 | void IO::Drivers::Process::onProcessFinished(int exitCode, QProcess::ExitStatus status) |
| 507 | { |
| 508 | if (m_process) { |
| 509 | const QByteArray remaining = m_process->readAllStandardOutput(); |
| 510 | if (!remaining.isEmpty()) |
| 511 | publishReceivedData(remaining); |
| 512 | } |
| 513 | |
| 514 | const QString reason = (status == QProcess::CrashExit) ? tr("The process crashed.") |
| 515 | : tr("Exit code: %1").arg(exitCode); |
| 516 | |
| 517 | Misc::Utilities::showMessageBox( |
| 518 | tr("Process \"%1\" stopped").arg(QFileInfo(m_executable).fileName()), |
| 519 | reason, |
| 520 | QMessageBox::Warning); |
| 521 | |
| 522 | QMetaObject::invokeMethod( |
| 523 | &IO::ConnectionManager::instance(), |
| 524 | [this] { IO::ConnectionManager::instance().disconnectDevice(this); }, |
| 525 | Qt::QueuedConnection); |
| 526 | } |
| 527 | |
| 528 | /** |
| 529 | * @brief Handles a QProcess-level error during execution. |
nothing calls this directly
no test coverage detected