Refactor some logic into separate settle_device method
This commit is contained in:
parent
22b6b27703
commit
301bd77312
|
@ -179,6 +179,7 @@ private:
|
|||
void close_device_and_disk() ;
|
||||
bool commit() ;
|
||||
bool commit_to_os( std::time_t timeout ) ;
|
||||
void settle_device( std::time_t timeout ) ;
|
||||
|
||||
static PedExceptionOption ped_exception_handler( PedException * e ) ;
|
||||
|
||||
|
|
|
@ -2666,16 +2666,21 @@ bool GParted_Core::commit_to_os( std::time_t timeout )
|
|||
else
|
||||
succes = ped_disk_commit_to_os( lp_disk ) ;
|
||||
|
||||
settle_device( timeout ) ;
|
||||
|
||||
return succes ;
|
||||
}
|
||||
|
||||
void GParted_Core::settle_device( std::time_t timeout )
|
||||
{
|
||||
if ( ! Glib::find_program_in_path( "udevsettle" ) .empty() )
|
||||
Utils::execute_command( "udevsettle --timeout=" + Utils::num_to_str( timeout ) ) ;
|
||||
else if ( ! Glib::find_program_in_path( "udevadm" ) .empty() )
|
||||
Utils::execute_command( "udevadm settle --timeout=" + Utils::num_to_str( timeout ) ) ;
|
||||
else
|
||||
sleep( timeout ) ;
|
||||
|
||||
return succes ;
|
||||
}
|
||||
|
||||
|
||||
PedExceptionOption GParted_Core::ped_exception_handler( PedException * e )
|
||||
{
|
||||
std::cout << e ->message << std::endl ;
|
||||
|
|
Loading…
Reference in New Issue