[GRASS-SVN] r30391 - grass/trunk/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Feb 28 12:05:41 EST 2008


Author: glynn
Date: 2008-02-28 12:05:40 -0500 (Thu, 28 Feb 2008)
New Revision: 30391

Modified:
   grass/trunk/lib/gis/spawn.c
Log:
Partial Windows implementation of G_[v]spawn_ex()



Modified: grass/trunk/lib/gis/spawn.c
===================================================================
--- grass/trunk/lib/gis/spawn.c	2008-02-28 17:05:11 UTC (rev 30390)
+++ grass/trunk/lib/gis/spawn.c	2008-02-28 17:05:40 UTC (rev 30391)
@@ -204,14 +204,37 @@
 
 #ifdef __MINGW32__
 
+static int do_redirects(struct redirect *redirects, int num_redirects)
+{
+	if (num_redirects > 0)
+		G_fatal_error("G_spawn_ex: redirection not (yet) supported on Windows");
+}
+
+static void do_bindings(char **env, struct binding *bindings, int num_bindings)
+{
+	if (num_bindings > 0)
+		G_fatal_error("G_spawn_ex: redirection not (yet) supported on Windows");
+
+	return env;
+}
+
 static int do_spawn(const char *command)
 {
-	G_warning("do_spawn: not implemented");
+	char **env;
+	int status;
 
-	return -1;
+	do_redirects(redirects, num_redirects);
+	env = do_bindings(_environ, bindings, num_bindings);
+
+	status = spawnvpe(background ? _P_NOWAIT : _P_WAIT, command, (char **) args, env);
+
+	if (!background && status < 0)
+		G_warning(_("Unable to execute command"));
+
+	return status;
 }
 
-#else
+#else  /* __MINGW32__ */
 
 static int undo_signals(struct signal *signals, int num_signals, int which)
 {



More information about the grass-commit mailing list