summaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2014-12-29 21:49:22 +0000
committerjstebbins <[email protected]>2014-12-29 21:49:22 +0000
commit30d1c1cc1e7db5336ba614947dfecb54b453917d (patch)
treec573ee47601c7f906f08d8a819abc965d985aa15 /gtk
parentcb8520e2fb899da0d42c000fda0bffb9dae3b3fa (diff)
LinGui: better stderr redirection on mingw
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6675 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk')
-rw-r--r--gtk/src/main.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gtk/src/main.c b/gtk/src/main.c
index 95479d022..8a8b6c666 100644
--- a/gtk/src/main.c
+++ b/gtk/src/main.c
@@ -628,10 +628,11 @@ IoRedirect(signal_user_data_t *ud)
g_io_channel_set_encoding(ud->activity_log, NULL, NULL);
// redirect stderr to the writer end of the pipe
#if defined(_WIN32)
- // dup2 doesn't work on windows for some stupid reason
- stderr->_file = pfd[1];
+ _dup2(pfd[1], STDERR_FILENO);
+ // Non-console windows apps do not have a stderr->_file assigned properly
+ stderr->_file = STDERR_FILENO;
#else
- dup2(pfd[1], /*stderr*/2);
+ dup2(pfd[1], STDERR_FILENO);
#endif
setvbuf(stderr, NULL, _IONBF, 0);
channel = g_io_channel_unix_new(pfd[0]);