Add chrootOutput/check_chroot_output to libcalamares utils API.

This commit is contained in:
Teo Mrnjavac 2014-08-08 14:12:53 +02:00
parent 648befb9bb
commit f90bf469dd
4 changed files with 103 additions and 15 deletions

View file

@ -104,6 +104,43 @@ check_chroot_call( const bp::list& args,
}
std::string
check_chroot_output( const std::string& command,
const std::string& stdin,
int timeout )
{
QString output;
int ec = CalamaresUtils::chrootOutput( QString::fromStdString( command ),
output,
QString::fromStdString( stdin ),
timeout );
_handle_check_chroot_call_error( ec, QString::fromStdString( command ) );
return output.toStdString();
}
std::string
check_chroot_output( const bp::list& args,
const std::string& stdin,
int timeout )
{
QString output;
QStringList list;
for ( int i = 0; i < bp::len( args ); ++i )
{
list.append( QString::fromStdString(
bp::extract< std::string >( args[ i ] ) ) );
}
int ec = CalamaresUtils::chrootOutput( list,
output,
QString::fromStdString( stdin ),
timeout );
_handle_check_chroot_call_error( ec, list.join( ' ' ) );
return output.toStdString();
}
int
_handle_check_chroot_call_error( int ec, const QString& cmd )
{