fastboot: don't print anything in Status() if the input is empty
Status() is called with an empty string to handle `fastboot oem` commands. This currently emits a set of spaces and sets last_start_time such that the epilog can track the time spent in this command. Emitting the spaces is problematic however, since it results in the follow: $ fastboot oem device-info (bootloader) Verity mode: false (bootloader) Device unlocked: true (bootloader) Device critical unlocked: true (bootloader) Charger screen enabled: true OKAY [ 0.000s] Finished. Total time: 0.000s If we skip emitting the spaces, then we get the correct result: $ fastboot oem device-info (bootloader) Verity mode: false (bootloader) Device unlocked: true (bootloader) Device critical unlocked: true (bootloader) Charger screen enabled: true OKAY [ 0.001s] Finished. Total time: 0.001s There are no other uses of Status() with an empty string, so this changes won't impact other commands. Bug: 158310284 Test: fastboot formats this and other commands correctly. Change-Id: I6294acefc65a8399160c0944b3fbc2f2ace919ed
This commit is contained in:
parent
71de690f60
commit
2217c50a4f
|
@ -200,8 +200,10 @@ static std::string find_item(const std::string& item) {
|
|||
double last_start_time;
|
||||
|
||||
static void Status(const std::string& message) {
|
||||
static constexpr char kStatusFormat[] = "%-50s ";
|
||||
fprintf(stderr, kStatusFormat, message.c_str());
|
||||
if (!message.empty()) {
|
||||
static constexpr char kStatusFormat[] = "%-50s ";
|
||||
fprintf(stderr, kStatusFormat, message.c_str());
|
||||
}
|
||||
last_start_time = now();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue