[PATCH] Scaffold -- Dont crash if project creation script fails to spawn
- From: Rui Lopes <rui ruilopes com>
- To: gnome-devtools gnome org
- Subject: [PATCH] Scaffold -- Dont crash if project creation script fails to spawn
- Date: 31 Aug 2003 22:17:59 +0100
Hi all,
In the attach are some Scaffold fixes:
* If project creation script failed to spawn, scaffold crashed.
* Don't hardcode python command path, use G_SPAWN_SEARCH_PATH
g_spawn_xxx flag.
* errmsg/outmsg g_spawn_sync arguments were swapped.
* Schema switch `--disable-schemas-install' was being ignored.
Regards,
Rui Lopes
# Some Scaffold fixes:
# * If project creation script failed to spawn, scaffold crashed.
# * Don't hardcode python command path, use G_SPAWN_SEARCH_PATH
# g_spawn_xxx flag.
# * errmsg/outmsg g_spawn_sync arguments were swapped.
# * Schema switch `--disable-schemas-install' was being ignored.
# -- Rui Lopes <rui ruilopes com>
Index: data/Makefile.am
===================================================================
RCS file: /cvs/gnome/scaffold/data/Makefile.am,v
retrieving revision 1.6
diff -u -r1.6 Makefile.am
--- data/Makefile.am 8 Aug 2003 20:44:18 -0000 1.6
+++ data/Makefile.am 31 Aug 2003 21:05:03 -0000
@@ -30,7 +30,7 @@
gladedir = $(datadir)/scaffold/glade/
glade_DATA = scaffold.glade
-install-data-local:
+install-schemas:
GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(srcdir)/$(schemas_DATA)
CLEANFILES = $(schemas_DATA) $(desktop_DATA) $(schemas_DATA)
Index: plugins/gnome-project-types/scaffold-gnome-application-type.c
===================================================================
RCS file: /cvs/gnome/scaffold/plugins/gnome-project-types/scaffold-gnome-application-type.c,v
retrieving revision 1.2
diff -u -r1.2 scaffold-gnome-application-type.c
--- plugins/gnome-project-types/scaffold-gnome-application-type.c 31 Jul 2003 08:55:25 -0000 1.2
+++ plugins/gnome-project-types/scaffold-gnome-application-type.c 31 Aug 2003 21:05:03 -0000
@@ -70,16 +70,16 @@
ScaffoldProjectInfo *info,
GError **error)
{
- char **args;
- char *scriptdir;
+ gchar **args;
+ const gchar *scriptdir;
GError *err = NULL;
- int status;
- char *errmsg, *outmsg;
+ gint status;
+ gchar *errmsg, *outmsg;
g_message ("create_project_impl");
- args = g_new0 (char *, 7);
- args[0] = g_strdup ("/usr/bin/python");
+ args = g_new (gchar *, 7);
+ args[0] = g_strdup ("python");
args[1] = g_strdup ("scaffold-gnome-application-create.py");
args[2] = g_strdup (info->name);
args[3] = g_strdup (info->package);
@@ -87,19 +87,25 @@
args[5] = g_strdup (info->location);
args[6] = NULL;
- scriptdir = g_strconcat (DATADIR, "/scaffold/plugins/gnome-project-types", NULL);
+ scriptdir = DATADIR "/scaffold/plugins/gnome-project-types";
g_message (scriptdir);
/* Spawn the python project creation script. */
- if (!g_spawn_sync (scriptdir, args, NULL, 0, NULL, NULL, &errmsg, &outmsg, &status, &err)) {
- g_message (errmsg);
- g_message (outmsg);
- g_message (err->message);
- *error = err;
+ if (!g_spawn_sync (scriptdir, args, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &outmsg, &errmsg, &status, &err)) {
+ /* Spawn failed. */
g_message ("error spawning script");
+ g_message (err->message);
+ }
+ else {
+ /* Spawn succeeded. */
+ g_message (outmsg);
+ g_message (errmsg);
+
+ g_free (outmsg);
+ g_free (errmsg);
}
- g_free (scriptdir);
+ *error = err;
g_strfreev (args);
}
Index: plugins/project-manager/project-tool.c
===================================================================
RCS file: /cvs/gnome/scaffold/plugins/project-manager/project-tool.c,v
retrieving revision 1.49
diff -u -r1.49 project-tool.c
--- plugins/project-manager/project-tool.c 8 Aug 2003 20:44:21 -0000 1.49
+++ plugins/project-manager/project-tool.c 31 Aug 2003 21:05:03 -0000
@@ -377,6 +377,7 @@
gdl_recent_add (proj_tool->recent, filename);
g_free (filename);
+ /* XXX: this should be freed with a function i.e. scaffold_project_druid_free_info. */
g_free (info->name);
g_free (info->package);
g_free (info->description);
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]