Fix copyblocks exit status check

This commit is contained in:
Huzaifa Faruqui 2018-02-06 22:32:26 +05:30
parent ac6dc0eb87
commit 72da110996
3 changed files with 10 additions and 4 deletions

View File

@ -45,7 +45,11 @@ bool Job::copyBlocks(Report& report, CopyTarget& target, CopySource& source)
ExternalCommand copyCmd(source, target, QProcess::SeparateChannels);
connect(&copyCmd, &ExternalCommand::progress, this, &Job::progress, Qt::QueuedConnection);
connect(&copyCmd, &ExternalCommand::reportSignal, this, &Job::updateReport, Qt::QueuedConnection);
return copyCmd.startCopyBlocks();
if (copyCmd.startCopyBlocks() && copyCmd.exitCode() == 0) {
return true;
}
return false;
}
bool Job::rollbackCopyBlocks(Report& report, CopyTarget& origTarget, CopySource& origSource)

View File

@ -114,11 +114,11 @@ bool ExternalCommand::copyBlocks()
return false;
}
m_Output = job->data()[QStringLiteral("output")].toByteArray();
setExitCode(job->data()[QStringLiteral("exitCode")].toInt());
rval = job->data()[QStringLiteral("success")].toInt();
setExitCode(!rval);
emit finished();
return true;
return rval;
}
/** Creates a new ExternalCommand instance without Report.

View File

@ -166,6 +166,8 @@ ActionReply ExternalCommandHelper::copyblockshelper(const QVariantMap& args)
report[QStringLiteral("report")] = xi18ncp("@info:progress argument 2 is a string such as 7 bytes (localized accordingly)", "Copying 1 block (%2) finished.", "Copying %1 blocks (%2) finished.", blocksCopied, i18np("1 byte", "%1 bytes", bytesWritten));
HelperSupport::progressStep(report);
reply.addData(QStringLiteral("success"), rval);
return reply;
}