grin-wallet icon indicating copy to clipboard operation
grin-wallet copied to clipboard

Term should output without colors if colors unavailable

Open seelin opened this issue 6 years ago • 3 comments

Should I should handle errors when I perform "./grin --floonet wallet outputs", should I respond?

root@TX01:/data/grin# ./grin --floonet wallet outputs
Password:

20190108 19:32:37.286 ERROR grin_util::logger - thread 'main' panicked at 'called Result::unwrap() on an Err value: ColorOutOfRange': libcore/result.rs:1009stack backtrace: 0: 0x55790812874d - backtrace::backtrace::trace::hd74837959dc31a2c 1: 0x557908127962 - <backtrace::capture::Backtrace as core::default::Default>::default::hfbe03539066da14f 2: 0x5579081279d9 - backtrace::capture::Backtrace::new::hd9d47426559d8b68 3: 0x5579080b8ae0 - grin_util::logger::send_panic_to_log::{{closure}}::h0919c24963251ad6 4: 0x5579081f8416 - std::panicking::rust_panic_with_hook::hde420d6fd4455550 at libstd/panicking.rs:480 5: 0x5579081f7f61 - std::panicking::continue_panic_fmt::h8f394f3c578bcc76 at libstd/panicking.rs:390 6: 0x5579081f7e45 - rust_begin_unwind at libstd/panicking.rs:325 7: 0x557908241ebc - core::panicking::panic_fmt::hca5dc4e8b320bc56 at libcore/panicking.rs:77 8: 0x557907c0e6a9 - core::result::unwrap_failed::hfe0779afeaefd5ae 9: 0x557907bd0efb - grin_wallet::display::outputs::hdbc67f2895df033e 10: 0x557907a021c1 - grin_wallet::controller::owner_single_use::h13e0ae4138880dcc 11: 0x5579079abc48 - grin_wallet::command::outputs::hb0d7f9e779d5c519 12: 0x5579079a34ea - grin::cmd::wallet_args::wallet_command::h9588b7d4e2e05e87 13: 0x557907958dda - grin::cmd::wallet::wallet_command::h2fbcdf54a1f66b70 14: 0x5579079c2cab - grin::real_main::hb39a0190d567a13c 15: 0x5579079c1575 - grin::main::hab1e977be2785e7c 16: 0x557907992f52 - std::rt::lang_start::{{closure}}::h2873acc0c7532388 17: 0x5579081f7de2 - std::rt::lang_start_internal::{{closure}}::hafa8ecdacd368ebb at libstd/rt.rs:59 - std::panicking::try::do_call::h8c0dbb48abbdf4df at libstd/panicking.rs:310 18: 0x55790820a4b9 - __rust_maybe_catch_panic at libpanic_unwind/lib.rs:102 19: 0x5579081d963a - std::panicking::try::hbc21637ba5f64d73 at libstd/panicking.rs:289 - std::panic::catch_unwind::h954917b922b8d970 at libstd/panic.rs:392 - std::rt::lang_start_internal::h5b2de3cc38c3b406 at libstd/rt.rs:58 20: 0x5579079c3b14 - main 21: 0x7f1a54e7d82f - __libc_start_main 22: 0x557907903a88 - _start 23: 0x0 -

Thread 'main' panicked with message: "called Result::unwrap() on an Err value: ColorOutOfRange"

when

seelin avatar Jan 08 '19 11:01 seelin

Kind of a weird error - assume its related to term attempting to render the nice table of data in pretty colors (and failing horribly) -

https://stebalien.github.io/doc/term/term/enum.Error.html#variant.ColorOutOfRange

antiochp avatar Jan 08 '19 13:01 antiochp

If people have grown attached to the pretty colors, instead of simplifying to remove the coloration (like I've once tried to PR), maybe we could detect if the terminal is capable and implement an alternative output without colors. PR welcome? If detecting terminal capabilities fails too often, then maybe we should do like ls and have some flag or settings to decide between using colors or not.

sesam avatar Jan 08 '19 13:01 sesam

Yeah, usually colors are avoided in terminal apps exactly for this reason, there are a bunch of different terminals in use and you cannot account for everyone. Simpler to avoid colors altogether.

0xmichalis avatar Jan 08 '19 14:01 0xmichalis