[libcalamares] Allow Runner instances to collect output
This commit is contained in:
parent
870009e815
commit
953b899f75
@ -94,12 +94,6 @@ namespace Calamares
|
|||||||
namespace Utils
|
namespace Utils
|
||||||
{
|
{
|
||||||
|
|
||||||
struct Runner::Private
|
|
||||||
{
|
|
||||||
QProcess m_process;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
Runner::Runner() {}
|
Runner::Runner() {}
|
||||||
|
|
||||||
|
|
||||||
@ -147,6 +141,20 @@ Calamares::Utils::Runner::run()
|
|||||||
process.setArguments( m_command );
|
process.setArguments( m_command );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( m_output )
|
||||||
|
{
|
||||||
|
connect( &process, &QProcess::readyReadStandardOutput, [this, &process]() {
|
||||||
|
while ( process.canReadLine() )
|
||||||
|
{
|
||||||
|
QString s = process.readLine();
|
||||||
|
if ( !s.isEmpty() )
|
||||||
|
{
|
||||||
|
Q_EMIT this->output( s );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
cDebug() << Logger::SubEntry << "Running" << Logger::Redacted( m_command );
|
cDebug() << Logger::SubEntry << "Running" << Logger::Redacted( m_command );
|
||||||
process.start();
|
process.start();
|
||||||
if ( !process.waitForStarted() )
|
if ( !process.waitForStarted() )
|
||||||
|
@ -109,10 +109,6 @@ private:
|
|||||||
QString m_input;
|
QString m_input;
|
||||||
std::chrono::milliseconds m_timeout { 0 };
|
std::chrono::milliseconds m_timeout { 0 };
|
||||||
bool m_output = false;
|
bool m_output = false;
|
||||||
|
|
||||||
// Internals for when it really does run
|
|
||||||
struct Private;
|
|
||||||
std::unique_ptr< Private > d;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Utils
|
} // namespace Utils
|
||||||
|
Loading…
Reference in New Issue
Block a user