+2004-03-10 Tor Lillqvist <tml@iki.fi>
+
+ * glib/gspawn-win32.c
+ * glib/gspawn-win32-helper.c: Implement
+ G_SPAWN_FILE_AND_ARGV_ZERO. (#136792, Bruce Hochstetler)
+
+ * tests/spawn-test.c
+ * tests/spawn-test-win32-gui.c: Test it.
+
Tue Mar 9 09:16:11 2004 Owen Taylor <otaylor@redhat.com>
* === Released 2.3.6 ===
+2004-03-10 Tor Lillqvist <tml@iki.fi>
+
+ * glib/gspawn-win32.c
+ * glib/gspawn-win32-helper.c: Implement
+ G_SPAWN_FILE_AND_ARGV_ZERO. (#136792, Bruce Hochstetler)
+
+ * tests/spawn-test.c
+ * tests/spawn-test-win32-gui.c: Test it.
+
Tue Mar 9 09:16:11 2004 Owen Taylor <otaylor@redhat.com>
* === Released 2.3.6 ===
+2004-03-10 Tor Lillqvist <tml@iki.fi>
+
+ * glib/gspawn-win32.c
+ * glib/gspawn-win32-helper.c: Implement
+ G_SPAWN_FILE_AND_ARGV_ZERO. (#136792, Bruce Hochstetler)
+
+ * tests/spawn-test.c
+ * tests/spawn-test-win32-gui.c: Test it.
+
Tue Mar 9 09:16:11 2004 Owen Taylor <otaylor@redhat.com>
* === Released 2.3.6 ===
+2004-03-10 Tor Lillqvist <tml@iki.fi>
+
+ * glib/gspawn-win32.c
+ * glib/gspawn-win32-helper.c: Implement
+ G_SPAWN_FILE_AND_ARGV_ZERO. (#136792, Bruce Hochstetler)
+
+ * tests/spawn-test.c
+ * tests/spawn-test-win32-gui.c: Test it.
+
Tue Mar 9 09:16:11 2004 Owen Taylor <otaylor@redhat.com>
* === Released 2.3.6 ===
+2004-03-10 Tor Lillqvist <tml@iki.fi>
+
+ * glib/gspawn-win32.c
+ * glib/gspawn-win32-helper.c: Implement
+ G_SPAWN_FILE_AND_ARGV_ZERO. (#136792, Bruce Hochstetler)
+
+ * tests/spawn-test.c
+ * tests/spawn-test-win32-gui.c: Test it.
+
Tue Mar 9 09:16:11 2004 Owen Taylor <otaylor@redhat.com>
* === Released 2.3.6 ===
+2004-03-10 Tor Lillqvist <tml@iki.fi>
+
+ * glib/gspawn-win32.c
+ * glib/gspawn-win32-helper.c: Implement
+ G_SPAWN_FILE_AND_ARGV_ZERO. (#136792, Bruce Hochstetler)
+
+ * tests/spawn-test.c
+ * tests/spawn-test-win32-gui.c: Test it.
+
Tue Mar 9 09:16:11 2004 Owen Taylor <otaylor@redhat.com>
* === Released 2.3.6 ===
int handle;
int no_error = CHILD_NO_ERROR;
int zero = 0;
+ gint file_and_argv_zero = 0;
gchar **new_argv;
SETUP_DEBUG();
*/
child_err_report_fd = atoi (__argv[ARG_CHILD_ERR_REPORT]);
+ /* Hack to implement G_SPAWN_FILE_AND_ARGV_ZERO */
+ if (__argv[ARG_CHILD_ERR_REPORT][strlen (__argv[ARG_CHILD_ERR_REPORT]) - 1] == '#')
+ file_and_argv_zero = 1;
+
/* argv[ARG_STDIN..ARG_STDERR] are the file descriptors that should
* be dup2'd to stdin, stdout and stderr, '-' if the corresponding
* std* should be let alone, and 'z' if it should be connected to
__argv[ARG_PROGRAM],
(mode == P_WAIT ?
"P_WAIT" : "P_NOWAIT")));
- i = ARG_PROGRAM+1;
+ i = ARG_PROGRAM + 1 + file_and_argv_zero;
while (new_argv[i])
{
g_string_append (debugstring, new_argv[i++]);
}
if (new_argv[ARG_USE_PATH][0] == 'y')
- handle = spawnvp (mode, __argv[ARG_PROGRAM], new_argv+ARG_PROGRAM);
+ handle = spawnvp (mode, __argv[ARG_PROGRAM], new_argv + ARG_PROGRAM + file_and_argv_zero);
else
- handle = spawnv (mode, __argv[ARG_PROGRAM], new_argv+ARG_PROGRAM);
+ handle = spawnv (mode, __argv[ARG_PROGRAM], new_argv + ARG_PROGRAM + file_and_argv_zero);
if (debug)
{
* The structure of the source code in this file is a mess, I know.
*/
-/* FIXME: Actually implement G_SPAWN_FILE_AND_ARGV_ZERO */
-
/* Define this to get some logging all the time */
/* #define G_SPAWN_WIN32_DEBUG */
g_print ("doing without gspawn-win32-helper\n");
if (search_path)
- rc = spawnvp (mode, argv[0], protected_argv);
+ rc = spawnvp (mode, argv[0], file_and_argv_zero ? protected_argv + 1 : protected_argv);
else
- rc = spawnv (mode, argv[0], protected_argv);
+ rc = spawnv (mode, argv[0], file_and_argv_zero ? protected_argv + 1 : protected_argv);
for (i = 0; i < argc; i++)
g_free (protected_argv[i]);
_g_sprintf (args[ARG_CHILD_ERR_REPORT], "%d", child_err_report_fd);
new_argv[ARG_CHILD_ERR_REPORT] = args[ARG_CHILD_ERR_REPORT];
+ if (file_and_argv_zero)
+ {
+ /* Overload ARG_CHILD_ERR_REPORT to also encode the
+ * G_SPAWN_FILE_AND_ARGV_ZERO functionality.
+ */
+ strcat (args[ARG_CHILD_ERR_REPORT], "#");
+ }
+
if (stdin_fd >= 0)
{
_g_sprintf (args[ARG_STDIN], "%d", stdin_fd);
char *lpszCmdLine,
int nCmdShow)
{
- if (__argc <= 2)
+ char buf[100];
+
+ if (__argc >= 2 && strcmp (__argv[1], "nop") == 0)
+ {
+ sprintf (buf, "spawn-test-win32-gui: argv[0]=\"%s\"", __argv[0]);
+ MessageBox (NULL, buf, lpszCmdLine, MB_ICONINFORMATION|MB_SYSTEMMODAL);
+ }
+ else if (__argc <= 2)
{
MessageBox (NULL, "spawn-test-win32-gui: Will write to stdout",
lpszCmdLine, MB_ICONINFORMATION|MB_SYSTEMMODAL);
int infd = atoi (__argv[2]);
int outfd = atoi (__argv[3]);
int k, n;
- char buf[100];
if (infd < 0 || outfd < 0)
{
}
}
- MessageBox (NULL, "spawn-test-win32-gui: Sleeping a bit.",
- lpszCmdLine, MB_ICONINFORMATION|MB_SYSTEMMODAL);
-
Sleep (2000);
MessageBox (NULL, "spawn-test-win32-gui: Done, exiting.",
erroutput = NULL;
}
- printf ("Starting spawn-test-win32-gui asynchronously (without wait).\n"
- "Click on the OK buttons.\n");
+ printf ("Running spawn-test-win32-gui in various ways. Click on the OK buttons.\n");
+
+ printf ("First asynchronously (without wait).\n");
if (!g_spawn_command_line_async ("'.\\spawn-test-win32-gui.exe' 1", &err))
{
exit (1);
}
- printf ("Running spawn-test-win32-gui synchronously,\n"
- "collecting its output. Click on the OK buttons.\n");
+ printf ("Now synchronously, collecting its output.\n");
if (!g_spawn_command_line_sync ("'.\\spawn-test-win32-gui.exe' 2",
&output, &erroutput, NULL,
&err))
g_free (erroutput);
}
- printf ("Running spawn-test-win32-gui asynchronously again.\n"
- "This time talking to it through pipes. Click on the OK buttons.\n");
+ printf ("Now with G_SPAWN_FILE_AND_ARGV_ZERO.\n");
+
+ if (!g_shell_parse_argv ("'.\\spawn-test-win32-gui.exe' this-should-be-argv-zero nop", NULL, &argv, &err))
+ {
+ fprintf (stderr, "Error parsing command line? %s\n", err->message);
+ g_error_free (err);
+ exit (1);
+ }
+
+ if (!g_spawn_async (NULL, argv, NULL,
+ G_SPAWN_FILE_AND_ARGV_ZERO,
+ NULL, NULL, NULL,
+ &err))
+ {
+ fprintf (stderr, "Error: %s\n", err->message);
+ g_error_free (err);
+ exit (1);
+ }
+
+ printf ("Now talking to it through pipes.\n");
if (pipe (pipedown) < 0 ||
pipe (pipeup) < 0)