diff --git a/src/HomeWidget.cpp b/src/HomeWidget.cpp index a883be09..9adf114e 100644 --- a/src/HomeWidget.cpp +++ b/src/HomeWidget.cpp @@ -162,24 +162,14 @@ void HomeWidget::reboot() bool create3StopRet = create3ServerStop.waitForFinished(); qDebug() << "Create 3 server stop return value: " << create3StopRet; qDebug() << "Create 3 server exit code: " << create3ServerStop.exitCode(); - if (!create3StopRet || create3ServerStop.exitCode() != 0) - { - QMessageBox::information(this, "Failed", "Create 3 server could not be stopped."); - msgBox->close(); - return; - } + if(create3StopRet == false) + QMessageBox::information(this, "Failed", "Create 3 server could not be stopped."); qDebug() << "Rebooting the system..."; // Reboot the system - QProcess rebootProcess; - rebootProcess.start("sudo", QStringList() << "reboot"); - bool rebootRet = rebootProcess.waitForFinished(); - qDebug() << "Reboot process return value: " << rebootRet; - qDebug() << "Reboot process exit code: " << rebootProcess.exitCode(); - if (!rebootRet || rebootProcess.exitCode() != 0) - { - QMessageBox::information(this, "Failed", "Reboot failed."); - } + const int rebootRet = QProcess::execute("reboot"); + if(create3StopRet == false || rebootRet < 0) + QMessageBox::information(this, "Failed", "Reboot failed."); msgBox->close(); });