[libcalamares] Run emergency jobs

- After a failure, skip non-emergency jobs.
 - After running all emergency jobs, then emit failure message.
 - In log, distinguish emergency and non-emergency jobs.
main
Adriaan de Groot 7 years ago
parent 8387d5d81f
commit 264d135776

@ -50,22 +50,36 @@ public:
void run() override
{
bool anyFailed = false;
QString message;
QString details;
m_jobIndex = 0;
for( auto job : m_jobs )
{
if ( anyFailed && !job->isEmergency() )
{
cDebug() << "Skipping non-emergency job" << job->prettyName();
continue;
}
emitProgress();
cDebug() << "Starting job" << job->prettyName();
cDebug() << "Starting" << ( anyFailed ? "EMERGENCY JOB" : "job" ) << job->prettyName();
connect( job.data(), &Job::progress, this, &JobThread::emitProgress );
JobResult result = job->exec();
if ( !result )
if ( !anyFailed && !result )
{
emitFailed( result.message(), result.details() );
emitFinished();
return;
anyFailed = true;
message = result.message();
details = result.details();
}
++m_jobIndex;
if ( !anyFailed )
++m_jobIndex;
}
emitProgress();
if ( anyFailed )
emitFailed( message, details );
else
emitProgress();
emitFinished();
}

Loading…
Cancel
Save