mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 19:05:46 -05:00
[libcalamares] Error out on empty command
- an empty command isn't going to work (although it might successfully run chroot or env in the target system, that's not useful) - while here, move variable declarations closer to their use.
This commit is contained in:
parent
88c75fb5dc
commit
752399ca6b
1 changed files with 7 additions and 3 deletions
|
@ -124,7 +124,11 @@ System::runCommand( System::RunLocation location,
|
|||
const QString& stdInput,
|
||||
std::chrono::seconds timeoutSec )
|
||||
{
|
||||
QString output;
|
||||
if ( args.isEmpty() )
|
||||
{
|
||||
cWarning() << "Cannot run an empty program list";
|
||||
return ProcessResult::Code::FailedToStart;
|
||||
}
|
||||
|
||||
Calamares::GlobalStorage* gs
|
||||
= Calamares::JobQueue::instance() ? Calamares::JobQueue::instance()->globalStorage() : nullptr;
|
||||
|
@ -135,7 +139,6 @@ System::runCommand( System::RunLocation location,
|
|||
return ProcessResult::Code::NoWorkingDirectory;
|
||||
}
|
||||
|
||||
QProcess process;
|
||||
QString program;
|
||||
QStringList arguments( args );
|
||||
|
||||
|
@ -156,6 +159,7 @@ System::runCommand( System::RunLocation location,
|
|||
program = "env";
|
||||
}
|
||||
|
||||
QProcess process;
|
||||
process.setProgram( program );
|
||||
process.setArguments( arguments );
|
||||
process.setProcessChannelMode( QProcess::MergedChannels );
|
||||
|
@ -195,7 +199,7 @@ System::runCommand( System::RunLocation location,
|
|||
return ProcessResult::Code::TimedOut;
|
||||
}
|
||||
|
||||
output.append( QString::fromLocal8Bit( process.readAllStandardOutput() ).trimmed() );
|
||||
QString output = QString::fromLocal8Bit( process.readAllStandardOutput() ).trimmed();
|
||||
|
||||
if ( process.exitStatus() == QProcess::CrashExit )
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue