summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/tkWinInit.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/win/tkWinInit.c b/win/tkWinInit.c
index a36ece4..4a327a2 100644
--- a/win/tkWinInit.c
+++ b/win/tkWinInit.c
@@ -121,6 +121,20 @@ TkpDisplayWarning(
WCHAR *msgString; /* points to titleString, just after title, leaving space for ": " */
int len; /* size of title, including terminating NULL */
+ /* If running on Cygwin and we have a stderr channel, use it. */
+#if !defined(STATIC_BUILD)
+ if (tclStubsPtr->reserved9) {
+ Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR);
+ if (errChannel) {
+ Tcl_WriteChars(errChannel, title, -1);
+ Tcl_WriteChars(errChannel, ": ", 2);
+ Tcl_WriteChars(errChannel, msg, -1);
+ Tcl_WriteChars(errChannel, "\n", 1);
+ return;
+ }
+ }
+#endif /* !STATIC_BUILD */
+
len = MultiByteToWideChar(CP_UTF8, 0, title, -1, titleString, TK_MAX_WARN_LEN);
msgString = &titleString[len + 1];
titleString[TK_MAX_WARN_LEN - 1] = L'\0';