diff options
Diffstat (limited to 'gdb/guile')
-rw-r--r-- | gdb/guile/scm-color.c | 11 | ||||
-rw-r--r-- | gdb/guile/scm-ports.c | 10 |
2 files changed, 17 insertions, 4 deletions
diff --git a/gdb/guile/scm-color.c b/gdb/guile/scm-color.c index 4850575..cde22e5 100644 --- a/gdb/guile/scm-color.c +++ b/gdb/guile/scm-color.c @@ -24,6 +24,7 @@ #include "language.h" #include "arch-utils.h" #include "guile-internal.h" +#include "cli/cli-style.h" /* A GDB color. */ @@ -354,8 +355,14 @@ gdbscm_color_escape_sequence (SCM self, SCM is_fg_scm) const ui_file_style::color &color = coscm_get_color (self); SCM_ASSERT_TYPE (gdbscm_is_bool (is_fg_scm), is_fg_scm, SCM_ARG2, FUNC_NAME, _("boolean")); - bool is_fg = gdbscm_is_true (is_fg_scm); - std::string s = color.to_ansi (is_fg); + + std::string s; + if (term_cli_styling ()) + { + bool is_fg = gdbscm_is_true (is_fg_scm); + s = color.to_ansi (is_fg); + } + return gdbscm_scm_from_host_string (s.c_str (), s.size ()); } diff --git a/gdb/guile/scm-ports.c b/gdb/guile/scm-ports.c index ed43d64..f3e3ec8 100644 --- a/gdb/guile/scm-ports.c +++ b/gdb/guile/scm-ports.c @@ -336,9 +336,15 @@ ioscm_flush (SCM port) return; if (scm_is_eq (port, error_port_scm)) - gdb_flush (gdb_stderr); + { + if (gdb_stderr != nullptr) + gdb_flush (gdb_stderr); + } else - gdb_flush (gdb_stdout); + { + if (gdb_stdout != nullptr) + gdb_flush (gdb_stdout); + } } #else /* !USING_GUILE_BEFORE_2_2 */ |