From 08db5acc6befd72c40c3c0e2b0603e7d8a2d7ce8 Mon Sep 17 00:00:00 2001 From: Patrick Storz Date: Tue, 2 Jul 2019 21:52:57 +0200 Subject: Avoid outputting control characters to non-tty destinations. --- src/inkscape-application.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/inkscape-application.cpp b/src/inkscape-application.cpp index 23bdb4e57..272bdce6d 100644 --- a/src/inkscape-application.cpp +++ b/src/inkscape-application.cpp @@ -461,6 +461,17 @@ template void ConcreteInkscapeApplication::_start_main_option_section(const Glib::ustring& section_name) { +#ifndef _WIN32 + // Avoid outputting control characters to non-tty destinations. + // + // However, isatty() is not useful on Windows + // - it doesn't recognize mintty and similar terminals + // - it doesn't work in cmd.exe either, where we have to use the inkscape.com wrapper, connecting stdout to a pipe + if (!isatty(fileno(stdout))) { + return; + } +#endif + this->add_main_option_entry(T::OPTION_TYPE_BOOL, Glib::ustring("\b\b \n") + section_name + ":"); } -- cgit v1.2.3