pidgin: fedb7de8: Fix output redirection for perl plugins ...
datallah at pidgin.im
datallah at pidgin.im
Mon Jul 28 00:55:48 EDT 2008
-----------------------------------------------------------------
Revision: fedb7de8d5fe70aa0cd0ee66f32050b68f5fd230
Ancestor: d2cd3e5430d76031ed040b2ec4dc863521645abb
Author: datallah at pidgin.im
Date: 2008-07-28T04:49:39
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/fedb7de8d5fe70aa0cd0ee66f32050b68f5fd230
Modified files:
libpurple/plugins/perl/perl.c
ChangeLog:
Fix output redirection for perl plugins on win32.
-------------- next part --------------
============================================================
--- libpurple/plugins/perl/perl.c c1868472d4e3416131697946cd96ab6411e1cfaa
+++ libpurple/plugins/perl/perl.c ff81c8afd465331cc0a6e09359f5c34d4967d566
@@ -267,6 +267,24 @@ probe_perl_plugin(PurplePlugin *plugin)
PL_perl_destruct_level = 1;
perl_construct(prober);
+/* Fix IO redirection to match where pidgin's is going.
+ * Without this, we lose stdout/stderr unless we redirect to a file */
+#ifdef _WIN32
+{
+ PerlIO* newprlIO = PerlIO_open("CONOUT$", "w");
+ if (newprlIO) {
+ int stdout_fd = PerlIO_fileno(PerlIO_stdout());
+ int stderr_fd = PerlIO_fileno(PerlIO_stderr());
+ PerlIO_close(PerlIO_stdout());
+ PerlIO_close(PerlIO_stderr());
+ PerlLIO_dup2(PerlIO_fileno(newprlIO), stdout_fd);
+ PerlLIO_dup2(PerlIO_fileno(newprlIO), stderr_fd);
+
+ PerlIO_close(newprlIO);
+ }
+}
+#endif
+
perl_parse(prober, xs_init, argc, argv, NULL);
perl_run(prober);
More information about the Commits
mailing list