glib/gspawn-win32.c Implement G_SPAWN_FILE_AND_ARGV_ZERO. (#136792, Bruce

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.
This commit is contained in:
Tor Lillqvist
2004-03-10 22:59:14 +00:00
committed by Tor Lillqvist
parent 55df929d48
commit f4cb22c78d
10 changed files with 104 additions and 18 deletions

View File

@@ -76,6 +76,7 @@ WinMain (struct HINSTANCE__ *hInstance,
int handle;
int no_error = CHILD_NO_ERROR;
int zero = 0;
gint file_and_argv_zero = 0;
gchar **new_argv;
SETUP_DEBUG();
@@ -105,6 +106,10 @@ WinMain (struct HINSTANCE__ *hInstance,
*/
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
@@ -220,7 +225,7 @@ WinMain (struct HINSTANCE__ *hInstance,
__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++]);
@@ -231,9 +236,9 @@ WinMain (struct HINSTANCE__ *hInstance,
}
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)
{