]> granicus.if.org Git - handbrake/commitdiff
LinGui: better stderr redirection on mingw
authorjstebbins <jstebbins.hb@gmail.com>
Mon, 29 Dec 2014 21:49:22 +0000 (21:49 +0000)
committerjstebbins <jstebbins.hb@gmail.com>
Mon, 29 Dec 2014 21:49:22 +0000 (21:49 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6675 b64f7644-9d1e-0410-96f1-a4d463321fa5

gtk/src/main.c

index 95479d022b9966dc88f79a300bf6ac1e5856e5ed..8a8b6c6668e5f865fa74cf94d5b933110b9f5fee 100644 (file)
@@ -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]);