Skip to content

Commit

Permalink
More robust output catching
Browse files Browse the repository at this point in the history
  • Loading branch information
erinharrington-12 committed Nov 25, 2024
1 parent 0d18e99 commit d17b10f
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions src/NetworkSettingsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,22 +340,30 @@ void NetworkSettingsWidget::rebootBox()
}
void NetworkSettingsWidget::editWifiConnectionMode(int newMode)
{
QProcess process;
QString command = QString("sed -i 's/^MODE.*/MODE %1/' /home/kipr/wombat-os/configFiles/wifiConnectionMode.txt").arg(newMode);

process.start("bash", QStringList() << "-c" << command);
process.waitForFinished();

if (process.exitStatus() == QProcess::NormalExit)
{
qDebug() << "Successfully set MODE to:" << newMode;
}
else
{
qDebug() << "Failed to set MODE.";
}
QProcess process;
QString command = QString("sudo sed -i 's/^MODE.*/MODE %1/' /home/kipr/wombat-os/configFiles/wifiConnectionMode.txt").arg(newMode);

// Start the process
process.start("bash", QStringList() << "-c" << command);
process.waitForFinished();

// Debug: Capture outputs
qDebug() << "Standard Output:" << process.readAllStandardOutput();
qDebug() << "Error Output:" << process.readAllStandardError();

// Check for success
if (process.exitCode() == 0 && process.exitStatus() == QProcess::NormalExit)
{
qDebug() << "Successfully set MODE to:" << newMode;
}
else
{
qDebug() << "Failed to set MODE. Exit code:" << process.exitCode()
<< "Exit status:" << process.exitStatus();
}
}


void NetworkSettingsWidget::indexChanged(int index)
{
NetworkManager::ref().turnOn();
Expand Down

0 comments on commit d17b10f

Please sign in to comment.