Do not use \r if output is not a terminal
Test / buildenv (push) Successful in 14s Details
Test / build (push) Failing after 1m28s Details
Test / make_test (push) Has been skipped Details
Test / test_add_osd (push) Has been skipped Details
Test / test_cas (push) Has been skipped Details
Test / test_change_pg_count (push) Has been skipped Details
Test / test_change_pg_count_ec (push) Has been skipped Details
Test / test_change_pg_size (push) Has been skipped Details
Test / test_create_nomaxid (push) Has been skipped Details
Test / test_etcd_fail (push) Has been skipped Details
Test / test_interrupted_rebalance (push) Has been skipped Details
Test / test_interrupted_rebalance_imm (push) Has been skipped Details
Test / test_interrupted_rebalance_ec (push) Has been skipped Details
Test / test_interrupted_rebalance_ec_imm (push) Has been skipped Details
Test / test_failure_domain (push) Has been skipped Details
Test / test_snapshot (push) Has been skipped Details
Test / test_snapshot_ec (push) Has been skipped Details
Test / test_minsize_1 (push) Has been skipped Details
Test / test_move_reappear (push) Has been skipped Details
Test / test_rm (push) Has been skipped Details
Test / test_snapshot_chain (push) Has been skipped Details
Test / test_snapshot_chain_ec (push) Has been skipped Details
Test / test_snapshot_down (push) Has been skipped Details
Test / test_snapshot_down_ec (push) Has been skipped Details
Test / test_splitbrain (push) Has been skipped Details
Test / test_rebalance_verify (push) Has been skipped Details
Test / test_rebalance_verify_imm (push) Has been skipped Details
Test / test_rebalance_verify_ec (push) Has been skipped Details
Test / test_rebalance_verify_ec_imm (push) Has been skipped Details
Test / test_switch_primary (push) Has been skipped Details
Test / test_write (push) Has been skipped Details
Test / test_write_xor (push) Has been skipped Details
Test / test_write_no_same (push) Has been skipped Details
Test / test_heal_pg_size_2 (push) Has been skipped Details
Test / test_heal_ec (push) Has been skipped Details
Test / test_heal_csum_32k_dmj (push) Has been skipped Details
Test / test_heal_csum_32k_dj (push) Has been skipped Details
Test / test_heal_csum_32k (push) Has been skipped Details
Test / test_heal_csum_4k_dmj (push) Has been skipped Details
Test / test_heal_csum_4k_dj (push) Has been skipped Details
Test / test_heal_csum_4k (push) Has been skipped Details
Test / test_scrub (push) Has been skipped Details
Test / test_scrub_zero_osd_2 (push) Has been skipped Details
Test / test_scrub_xor (push) Has been skipped Details
Test / test_scrub_pg_size_3 (push) Has been skipped Details
Test / test_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Has been skipped Details
Test / test_scrub_ec (push) Has been skipped Details

Vitaliy Filippov 2024-02-28 21:22:19 +03:00
parent 12b11b68f1
commit 476b0a256a
4 changed files with 22 additions and 7 deletions

View File

@ -125,7 +125,7 @@ static const char* help_text =
" --parallel_osds M Work with M osds in parallel when possible (default 4)\n" " --parallel_osds M Work with M osds in parallel when possible (default 4)\n"
" --progress 1|0 Report progress (default 1)\n" " --progress 1|0 Report progress (default 1)\n"
" --cas 1|0 Use CAS writes for flatten, merge, rm (default is decide automatically)\n" " --cas 1|0 Use CAS writes for flatten, merge, rm (default is decide automatically)\n"
" --no-color Disable colored output\n" " --color 1|0 Enable/disable colored output and CR symbols (default 1 if stdout is a terminal)\n"
" --json JSON output\n" " --json JSON output\n"
; ;

View File

@ -113,7 +113,12 @@ void cli_tool_t::parse_config(json11::Json::object & cfg)
else else
kv_it++; kv_it++;
} }
color = !cfg["no_color"].bool_value(); if (cfg.find("no_color") != cfg.end())
color = !cfg["no_color"].bool_value();
else if (cfg.find("color") != cfg.end())
color = cfg["color"].bool_value();
else
color = isatty(1);
json_output = cfg["json"].bool_value(); json_output = cfg["json"].bool_value();
iodepth = cfg["iodepth"].uint64_value(); iodepth = cfg["iodepth"].uint64_value();
if (!iodepth) if (!iodepth)

View File

@ -275,7 +275,9 @@ struct snap_merger_t
processed++; processed++;
if (parent->progress && !(processed % 128)) if (parent->progress && !(processed % 128))
{ {
printf("\rFiltering target blocks: %ju/%ju", processed, to_process); fprintf(stderr, parent->color
? "\rFiltering target blocks: %ju/%ju"
: "Filtering target blocks: %ju/%ju\n", processed, to_process);
} }
} }
if (in_flight > 0 || oit != merge_offsets.end()) if (in_flight > 0 || oit != merge_offsets.end())
@ -285,7 +287,9 @@ struct snap_merger_t
} }
if (parent->progress) if (parent->progress)
{ {
printf("\r%ju full blocks of target filtered out\n", to_process-merge_offsets.size()); fprintf(stderr, parent->color
? "\r%ju full blocks of target filtered out\n"
: "%ju full blocks of target filtered out\n", to_process-merge_offsets.size());
} }
} }
state = 3; state = 3;
@ -320,7 +324,9 @@ struct snap_merger_t
processed++; processed++;
if (parent->progress && !(processed % 128)) if (parent->progress && !(processed % 128))
{ {
printf("\rOverwriting blocks: %ju/%ju", processed, to_process); fprintf(stderr, parent->color
? "\rOverwriting blocks: %ju/%ju"
: "Overwriting blocks: %ju/%ju\n", processed, to_process);
} }
} }
if (in_flight == 0 && rwo_error.size()) if (in_flight == 0 && rwo_error.size())
@ -339,7 +345,9 @@ struct snap_merger_t
} }
if (parent->progress) if (parent->progress)
{ {
printf("\rOverwriting blocks: %ju/%ju\n", to_process, to_process); fprintf(stderr, parent->color
? "\rOverwriting blocks: %ju/%ju\n"
: "Overwriting blocks: %ju/%ju\n", to_process, to_process);
} }
// Done // Done
result = (cli_result_t){ .text = "Done, layers from "+from_name+" to "+to_name+" merged into "+target_name }; result = (cli_result_t){ .text = "Done, layers from "+from_name+" to "+to_name+" merged into "+target_name };

View File

@ -213,7 +213,9 @@ struct rm_inode_t
} }
if (parent->progress && total_count > 0 && total_done*1000/total_count != total_prev_pct) if (parent->progress && total_count > 0 && total_done*1000/total_count != total_prev_pct)
{ {
fprintf(stderr, "\rRemoved %ju/%ju objects, %ju more PGs to list...", total_done, total_count, pgs_to_list); fprintf(stderr, parent->color
? "\rRemoved %ju/%ju objects, %ju more PGs to list..."
: "Removed %ju/%ju objects, %ju more PGs to list...\n", total_done, total_count, pgs_to_list);
total_prev_pct = total_done*1000/total_count; total_prev_pct = total_done*1000/total_count;
} }
if (lists_done && !lists.size()) if (lists_done && !lists.size())