+ /* XXX: this is a hack, but I expect we'll need logs and I'm not sure if there's
+ * a better place to put them.
+ */
+ dcpomatic_log.reset(new FileLog(config_path() / "dist_writer.log"));
+ dcpomatic_log->set_types (dcpomatic_log->types() | LogEntry::TYPE_DIST);
+ LOG_DIST_NC("dcpomatic_dist_writer started");
+
+#ifdef DCPOMATIC_WINDOWS
+ FreeConsole ();
+ AllocConsole ();
+
+ HANDLE handle_out = GetStdHandle(STD_OUTPUT_HANDLE);
+ int hCrt = _open_osfhandle((intptr_t) handle_out, _O_TEXT);
+ FILE* hf_out = _fdopen(hCrt, "w");
+ setvbuf(hf_out, NULL, _IONBF, 1);
+ *stdout = *hf_out;
+
+ HANDLE handle_in = GetStdHandle(STD_INPUT_HANDLE);
+ LOG_DIST ("handle_in is %1", reinterpret_cast<uint64_t>(handle_in));
+ hCrt = _open_osfhandle((intptr_t) handle_in, _O_TEXT);
+ FILE* hf_in = _fdopen(hCrt, "r");
+ setvbuf(hf_in, NULL, _IONBF, 128);
+ *stdin = *hf_in;
+#endif
+