Include <config.h> first here, too. Use g_io_channel_read_chars() instead
authorTor Lillqvist <tml@iki.fi>
Tue, 19 Feb 2002 09:08:24 +0000 (09:08 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Tue, 19 Feb 2002 09:08:24 +0000 (09:08 +0000)
2002-02-19  Tor Lillqvist  <tml@iki.fi>

* glib/gspawn-win32.c: Include <config.h> first here, too. Use
g_io_channel_read_chars() instead of (deprecated)
g_io_channel_read(). Set encoding to NULL for the channels used
for the pipes from the child.

* glib/giowin32.c (buffer_read): Do return G_IO_STATUS_EOF when
EOF has been reached. Otherwise, with the above change to
gspawn-win32.c, spawn-test hangs.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
glib/giowin32.c
glib/gspawn-win32.c

index 8b5106c..d71f60d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2002-02-19  Tor Lillqvist  <tml@iki.fi>
+
+       * glib/gspawn-win32.c: Include <config.h> first here, too. Use
+       g_io_channel_read_chars() instead of (deprecated)
+       g_io_channel_read(). Set encoding to NULL for the channels used
+       for the pipes from the child.
+
+       * glib/giowin32.c (buffer_read): Do return G_IO_STATUS_EOF when
+       EOF has been reached. Otherwise, with the above change to
+       gspawn-win32.c, spawn-test hangs.
+
 Mon Feb 18 20:18:23 2002  Owen Taylor  <otaylor@redhat.com>
 
        * glib/libcharset/Makefile.am (EXTRA_DIST): Remove
index 8b5106c..d71f60d 100644 (file)
@@ -1,3 +1,14 @@
+2002-02-19  Tor Lillqvist  <tml@iki.fi>
+
+       * glib/gspawn-win32.c: Include <config.h> first here, too. Use
+       g_io_channel_read_chars() instead of (deprecated)
+       g_io_channel_read(). Set encoding to NULL for the channels used
+       for the pipes from the child.
+
+       * glib/giowin32.c (buffer_read): Do return G_IO_STATUS_EOF when
+       EOF has been reached. Otherwise, with the above change to
+       gspawn-win32.c, spawn-test hangs.
+
 Mon Feb 18 20:18:23 2002  Owen Taylor  <otaylor@redhat.com>
 
        * glib/libcharset/Makefile.am (EXTRA_DIST): Remove
index 8b5106c..d71f60d 100644 (file)
@@ -1,3 +1,14 @@
+2002-02-19  Tor Lillqvist  <tml@iki.fi>
+
+       * glib/gspawn-win32.c: Include <config.h> first here, too. Use
+       g_io_channel_read_chars() instead of (deprecated)
+       g_io_channel_read(). Set encoding to NULL for the channels used
+       for the pipes from the child.
+
+       * glib/giowin32.c (buffer_read): Do return G_IO_STATUS_EOF when
+       EOF has been reached. Otherwise, with the above change to
+       gspawn-win32.c, spawn-test hangs.
+
 Mon Feb 18 20:18:23 2002  Owen Taylor  <otaylor@redhat.com>
 
        * glib/libcharset/Makefile.am (EXTRA_DIST): Remove
index 8b5106c..d71f60d 100644 (file)
@@ -1,3 +1,14 @@
+2002-02-19  Tor Lillqvist  <tml@iki.fi>
+
+       * glib/gspawn-win32.c: Include <config.h> first here, too. Use
+       g_io_channel_read_chars() instead of (deprecated)
+       g_io_channel_read(). Set encoding to NULL for the channels used
+       for the pipes from the child.
+
+       * glib/giowin32.c (buffer_read): Do return G_IO_STATUS_EOF when
+       EOF has been reached. Otherwise, with the above change to
+       gspawn-win32.c, spawn-test hangs.
+
 Mon Feb 18 20:18:23 2002  Owen Taylor  <otaylor@redhat.com>
 
        * glib/libcharset/Makefile.am (EXTRA_DIST): Remove
index 8b5106c..d71f60d 100644 (file)
@@ -1,3 +1,14 @@
+2002-02-19  Tor Lillqvist  <tml@iki.fi>
+
+       * glib/gspawn-win32.c: Include <config.h> first here, too. Use
+       g_io_channel_read_chars() instead of (deprecated)
+       g_io_channel_read(). Set encoding to NULL for the channels used
+       for the pipes from the child.
+
+       * glib/giowin32.c (buffer_read): Do return G_IO_STATUS_EOF when
+       EOF has been reached. Otherwise, with the above change to
+       gspawn-win32.c, spawn-test hangs.
+
 Mon Feb 18 20:18:23 2002  Owen Taylor  <otaylor@redhat.com>
 
        * glib/libcharset/Makefile.am (EXTRA_DIST): Remove
index 8b5106c..d71f60d 100644 (file)
@@ -1,3 +1,14 @@
+2002-02-19  Tor Lillqvist  <tml@iki.fi>
+
+       * glib/gspawn-win32.c: Include <config.h> first here, too. Use
+       g_io_channel_read_chars() instead of (deprecated)
+       g_io_channel_read(). Set encoding to NULL for the channels used
+       for the pipes from the child.
+
+       * glib/giowin32.c (buffer_read): Do return G_IO_STATUS_EOF when
+       EOF has been reached. Otherwise, with the above change to
+       gspawn-win32.c, spawn-test hangs.
+
 Mon Feb 18 20:18:23 2002  Owen Taylor  <otaylor@redhat.com>
 
        * glib/libcharset/Makefile.am (EXTRA_DIST): Remove
index 8b5106c..d71f60d 100644 (file)
@@ -1,3 +1,14 @@
+2002-02-19  Tor Lillqvist  <tml@iki.fi>
+
+       * glib/gspawn-win32.c: Include <config.h> first here, too. Use
+       g_io_channel_read_chars() instead of (deprecated)
+       g_io_channel_read(). Set encoding to NULL for the channels used
+       for the pipes from the child.
+
+       * glib/giowin32.c (buffer_read): Do return G_IO_STATUS_EOF when
+       EOF has been reached. Otherwise, with the above change to
+       gspawn-win32.c, spawn-test hangs.
+
 Mon Feb 18 20:18:23 2002  Owen Taylor  <otaylor@redhat.com>
 
        * glib/libcharset/Makefile.am (EXTRA_DIST): Remove
index 8b5106c..d71f60d 100644 (file)
@@ -1,3 +1,14 @@
+2002-02-19  Tor Lillqvist  <tml@iki.fi>
+
+       * glib/gspawn-win32.c: Include <config.h> first here, too. Use
+       g_io_channel_read_chars() instead of (deprecated)
+       g_io_channel_read(). Set encoding to NULL for the channels used
+       for the pipes from the child.
+
+       * glib/giowin32.c (buffer_read): Do return G_IO_STATUS_EOF when
+       EOF has been reached. Otherwise, with the above change to
+       gspawn-win32.c, spawn-test hangs.
+
 Mon Feb 18 20:18:23 2002  Owen Taylor  <otaylor@redhat.com>
 
        * glib/libcharset/Makefile.am (EXTRA_DIST): Remove
index e2a29d5..fae780c 100644 (file)
@@ -364,9 +364,11 @@ buffer_read (GIOWin32Channel *channel,
       LOCK (channel->mutex);
       if (channel->wrp == channel->rdp && !channel->running)
        {
+         if (channel->debug)
+           g_print ("wrp==rdp, !running\n");
          UNLOCK (channel->mutex);
           *bytes_read = 0;
-         return G_IO_STATUS_NORMAL; /* as before, normal case ? */
+         return G_IO_STATUS_EOF;
        }
     }
   
index 7cadc1e..2b85185 100644 (file)
@@ -37,6 +37,8 @@
 /* Define this to get some logging all the time */
 /* #define G_SPAWN_WIN32_DEBUG */
 
+#include <config.h>
+
 #include "glib.h"
 
 #include <string.h>
@@ -187,13 +189,13 @@ read_data (GString     *str,
            GIOChannel  *iochannel,
            GError     **error)
 {
-  GIOError gioerror;
+  GIOStatus giostatus;
   gint bytes;
   gchar buf[4096];
 
  again:
   
-  gioerror = g_io_channel_read (iochannel, buf, sizeof (buf), &bytes);
+  giostatus = g_io_channel_read_chars (iochannel, buf, sizeof (buf), &bytes, NULL);
 
   if (bytes == 0)
     return READ_EOF;
@@ -202,9 +204,9 @@ read_data (GString     *str,
       g_string_append_len (str, buf, bytes);
       return READ_OK;
     }
-  else if (gioerror == G_IO_ERROR_AGAIN)
+  else if (giostatus == G_IO_STATUS_AGAIN)
     goto again;
-  else if (gioerror != G_IO_ERROR_NONE)
+  else if (giostatus == G_IO_STATUS_ERROR)
     {
       g_set_error (error,
                    G_SPAWN_ERROR,
@@ -312,6 +314,7 @@ g_spawn_sync (const gchar          *working_directory,
     {
       outstr = g_string_new ("");
       outchannel = g_io_channel_win32_new_fd (outpipe);
+      g_io_channel_set_encoding (outchannel, NULL, NULL);
       g_io_channel_win32_make_pollfd (outchannel,
                                      G_IO_IN | G_IO_ERR | G_IO_HUP,
                                      &outfd);
@@ -321,6 +324,7 @@ g_spawn_sync (const gchar          *working_directory,
     {
       errstr = g_string_new ("");
       errchannel = g_io_channel_win32_new_fd (errpipe);
+      g_io_channel_set_encoding (errchannel, NULL, NULL);
       g_io_channel_win32_make_pollfd (errchannel,
                                      G_IO_IN | G_IO_ERR | G_IO_HUP,
                                      &errfd);