mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-27 07:56:14 +01:00
spawn-test-win32-gui: Write state to stderr
Makes TAP happier
This commit is contained in:
parent
1daf05ecda
commit
871c4b4698
@ -26,7 +26,7 @@ WinMain (struct HINSTANCE__ *hInstance,
|
|||||||
}
|
}
|
||||||
else if (__argc <= 2)
|
else if (__argc <= 2)
|
||||||
{
|
{
|
||||||
printf ("This is stdout\n");
|
printf ("# This is stdout\n");
|
||||||
fflush (stdout);
|
fflush (stdout);
|
||||||
|
|
||||||
fprintf (stderr, "This is stderr\n");
|
fprintf (stderr, "This is stderr\n");
|
||||||
@ -41,36 +41,36 @@ WinMain (struct HINSTANCE__ *hInstance,
|
|||||||
|
|
||||||
if (infd < 0 || outfd < 0)
|
if (infd < 0 || outfd < 0)
|
||||||
{
|
{
|
||||||
printf ("spawn-test-win32-gui: illegal fds on command line %s",
|
fprintf (stderr, "spawn-test-win32-gui: illegal fds on command line %s\n",
|
||||||
lpszCmdLine);
|
lpszCmdLine);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
n = strlen ("Hello there");
|
n = strlen ("Hello there");
|
||||||
if (write (outfd, &n, sizeof (n)) == -1 ||
|
if (write (outfd, &n, sizeof (n)) == -1 ||
|
||||||
write (outfd, "Hello there", n) == -1)
|
write (outfd, "Hello there\n", n) == -1)
|
||||||
{
|
{
|
||||||
int errsv = errno;
|
int errsv = errno;
|
||||||
printf ("spawn-test-win32-gui: Write error: %s", strerror (errsv));
|
fprintf (stderr, "spawn-test-win32-gui: Write error: %s\n", strerror (errsv));
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((k = read (infd, &n, sizeof (n))) != sizeof (n))
|
if ((k = read (infd, &n, sizeof (n))) != sizeof (n))
|
||||||
{
|
{
|
||||||
printf ("spawn-test-win32-gui: Got only %d bytes, wanted %d",
|
fprintf (stderr, "spawn-test-win32-gui: Got only %d bytes, wanted %d\n",
|
||||||
k, (int)sizeof (n));
|
k, (int)sizeof (n));
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf ("spawn-test-win32-gui: Parent says %d bytes to read", n);
|
fprintf (stderr, "spawn-test-win32-gui: Parent says %d bytes to read\n", n);
|
||||||
|
|
||||||
if ((k = read (infd, buf, n)) != n)
|
if ((k = read (infd, buf, n)) != n)
|
||||||
{
|
{
|
||||||
int errsv = errno;
|
int errsv = errno;
|
||||||
if (k == -1)
|
if (k == -1)
|
||||||
printf ("spawn-test-win32-gui: Read error: %s", strerror (errsv));
|
fprintf (stderr, "spawn-test-win32-gui: Read error: %s\n", strerror (errsv));
|
||||||
else
|
else
|
||||||
printf ("spawn-test-win32-gui: Got only %d bytes", k);
|
fprintf (stderr, "spawn-test-win32-gui: Got only %d bytes\n", k);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ WinMain (struct HINSTANCE__ *hInstance,
|
|||||||
write (outfd, "See ya", n) == -1)
|
write (outfd, "See ya", n) == -1)
|
||||||
{
|
{
|
||||||
int errsv = errno;
|
int errsv = errno;
|
||||||
printf ("spawn-test-win32-gui: Write error: %s", strerror (errsv));
|
fprintf (stderr, "spawn-test-win32-gui: Write error: %s\n", strerror (errsv));
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ test_spawn_basics (void)
|
|||||||
|
|
||||||
g_assert_no_error (err);
|
g_assert_no_error (err);
|
||||||
g_assert_true (result);
|
g_assert_true (result);
|
||||||
g_assert_cmpstr (output, ==, "This is stdout\r\n");
|
g_assert_cmpstr (output, ==, "# This is stdout\r\n");
|
||||||
g_assert_cmpstr (erroutput, ==, "This is stderr\r\n");
|
g_assert_cmpstr (erroutput, ==, "This is stderr\r\n");
|
||||||
|
|
||||||
g_free (output);
|
g_free (output);
|
||||||
|
Loading…
Reference in New Issue
Block a user