[libcalamares] Be more verbose in error situations

- runCommand can return NoWorkingDirectory in multiple places,
   make sure the log contains a more specific reason.
This commit is contained in:
Adriaan de Groot 2019-06-07 13:32:31 +02:00
parent b587d77e31
commit d7f5134121

View File

@ -114,15 +114,25 @@ System::mount( const QString& devicePath,
const QString& options ) const QString& options )
{ {
if ( devicePath.isEmpty() || mountPoint.isEmpty() ) if ( devicePath.isEmpty() || mountPoint.isEmpty() )
{
if ( devicePath.isEmpty() )
cWarning() << "Can't mount an empty device.";
if ( mountPoint.isEmpty() )
cWarning() << "Can't mount on an empty mountpoint.";
return static_cast<int>(ProcessResult::Code::NoWorkingDirectory); return static_cast<int>(ProcessResult::Code::NoWorkingDirectory);
}
QDir mountPointDir( mountPoint ); QDir mountPointDir( mountPoint );
if ( !mountPointDir.exists() ) if ( !mountPointDir.exists() )
{ {
bool ok = mountPointDir.mkpath( mountPoint ); bool ok = mountPointDir.mkpath( mountPoint );
if ( !ok ) if ( !ok )
{
cWarning() << "Could not create mountpoint" << mountPoint;
return static_cast<int>(ProcessResult::Code::NoWorkingDirectory); return static_cast<int>(ProcessResult::Code::NoWorkingDirectory);
} }
}
QString program( "mount" ); QString program( "mount" );
QStringList args = { devicePath, mountPoint }; QStringList args = { devicePath, mountPoint };
@ -147,7 +157,10 @@ System::runCommand(
QString output; QString output;
if ( !Calamares::JobQueue::instance() ) if ( !Calamares::JobQueue::instance() )
{
cError() << "No JobQueue";
return ProcessResult::Code::NoWorkingDirectory; return ProcessResult::Code::NoWorkingDirectory;
}
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
if ( ( location == System::RunLocation::RunInTarget ) && if ( ( location == System::RunLocation::RunInTarget ) &&