mirror of
https://gitlab.gnome.org/GNOME/gparted
synced 2024-09-20 16:31:23 +00:00
Pass string literals directly to execute_command()
There were a few cases of creating a local string variable from a literal and then passing the variable to execute_command() like this: Glib::ustring cmd = "whatever"; Utils::execute_command( cmd, ... ); This creates an unnecessary local variable. Instead pass the string literal directly to Utils::execute_command() like this: Utils::execute_command( "whatever", ... ); This also make the code a little bit more grep friendly.
This commit is contained in:
parent
25d2aa341c
commit
f5d3f97c7a
|
@ -322,7 +322,6 @@ bool DMRaid::create_dev_map_entries( const Partition & partition, OperationDetai
|
||||||
{
|
{
|
||||||
//Create all missing dev mapper entries for a specified device.
|
//Create all missing dev mapper entries for a specified device.
|
||||||
|
|
||||||
Glib::ustring command ;
|
|
||||||
bool exit_status = true ;
|
bool exit_status = true ;
|
||||||
|
|
||||||
/*TO TRANSLATORS: looks like create missing /dev/mapper entries */
|
/*TO TRANSLATORS: looks like create missing /dev/mapper entries */
|
||||||
|
@ -331,8 +330,7 @@ bool DMRaid::create_dev_map_entries( const Partition & partition, OperationDetai
|
||||||
|
|
||||||
//Newer dmraid defaults to always inserting the letter 'p' between the device name
|
//Newer dmraid defaults to always inserting the letter 'p' between the device name
|
||||||
// and the partition number.
|
// and the partition number.
|
||||||
command = "dmraid -ay -P \"\" -v" ;
|
if ( execute_command( "dmraid -ay -P \"\" -v", operationdetail.get_last_child() ) )
|
||||||
if ( execute_command( command, operationdetail .get_last_child() ) )
|
|
||||||
exit_status = false; // command failed
|
exit_status = false; // command failed
|
||||||
|
|
||||||
operationdetail .get_last_child() .set_status( exit_status ? STATUS_SUCCES : STATUS_ERROR ) ;
|
operationdetail .get_last_child() .set_status( exit_status ? STATUS_SUCCES : STATUS_ERROR ) ;
|
||||||
|
@ -344,13 +342,12 @@ bool DMRaid::create_dev_map_entries( const Glib::ustring & dev_path )
|
||||||
{
|
{
|
||||||
//Create all missing dev mapper entries for a specified device.
|
//Create all missing dev mapper entries for a specified device.
|
||||||
|
|
||||||
Glib::ustring command, output, error ;
|
Glib::ustring output, error ;
|
||||||
bool exit_status = true ;
|
bool exit_status = true ;
|
||||||
|
|
||||||
//Newer dmraid defaults to always inserting the letter 'p' between the device name
|
//Newer dmraid defaults to always inserting the letter 'p' between the device name
|
||||||
// and the partition number.
|
// and the partition number.
|
||||||
command = "dmraid -ay -P \"\" -v" ;
|
if ( Utils::execute_command( "dmraid -ay -P \"\" -v", output, error, true ) )
|
||||||
if ( Utils::execute_command( command, output, error, true ) )
|
|
||||||
exit_status = false; // command failed
|
exit_status = false; // command failed
|
||||||
|
|
||||||
return exit_status ;
|
return exit_status ;
|
||||||
|
|
|
@ -125,8 +125,8 @@ void SWRaid_Info::load_swraid_info_cache()
|
||||||
|
|
||||||
// Load SWRaid members into the cache. Load member device, array UUID and array
|
// Load SWRaid members into the cache. Load member device, array UUID and array
|
||||||
// label (array name in mdadm terminology).
|
// label (array name in mdadm terminology).
|
||||||
Glib::ustring cmd = "mdadm --examine --scan --verbose";
|
if ( mdadm_found &&
|
||||||
if ( mdadm_found && ! Utils::execute_command( cmd, output, error, true ) )
|
! Utils::execute_command( "mdadm --examine --scan --verbose", output, error, true ) )
|
||||||
{
|
{
|
||||||
// Extract information from Linux Software RAID arrays only, excluding
|
// Extract information from Linux Software RAID arrays only, excluding
|
||||||
// IMSM and DDF arrays. Example output:
|
// IMSM and DDF arrays. Example output:
|
||||||
|
|
|
@ -2772,9 +2772,7 @@ void Win_GParted::activate_attempt_rescue_data()
|
||||||
dialog.run();
|
dialog.run();
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
|
|
||||||
Glib::ustring commandUmount= "umount /tmp/gparted-roview*";
|
Utils::execute_command( "umount /tmp/gparted-roview*" );
|
||||||
|
|
||||||
Utils::execute_command(commandUmount);
|
|
||||||
|
|
||||||
menu_gparted_refresh_devices() ;
|
menu_gparted_refresh_devices() ;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue