OSDN Git Service

- set HandBrakeCLI stdio/stderr to unbuffered on native win32 platform;
authorkonablend <konablend@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Wed, 13 May 2009 19:27:22 +0000 (19:27 +0000)
committerkonablend <konablend@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Wed, 13 May 2009 19:27:22 +0000 (19:27 +0000)
  desired behavior is line-buffering but on win32 msvcrt there is no such thing and
  it becomes full-buffering which delays log/output enough to make it nonsensical.

git-svn-id: svn://localhost/HandBrake/trunk@2415 b64f7644-9d1e-0410-96f1-a4d463321fa5

test/test.c

index a1d9262..3fecfb1 100644 (file)
@@ -147,6 +147,14 @@ int main( int argc, char ** argv )
     int           build;
     char        * version;
 
+/* win32 _IOLBF (line-buffering) is the same as _IOFBF (full-buffering).
+ * force it to unbuffered otherwise informative output is not easily parsed.
+ */
+#if defined( _WIN32 ) || defined( __MINGW32__ )
+    setvbuf( stdout, NULL, _IONBF, 0 );
+    setvbuf( stderr, NULL, _IONBF, 0 );
+#endif
+
     audios = hb_list_init();
 
     /* Parse command line */