[anjuta] run: Improve handling of errors
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] run: Improve handling of errors
- Date: Fri, 25 Jun 2010 10:09:16 +0000 (UTC)
commit a9f3c478c800f22becc5542d4cfc3d4bebccc32d
Author: Sébastien Granjoux <seb sfo free fr>
Date: Fri Jun 25 11:21:40 2010 +0200
run: Improve handling of errors
plugins/run-program/execute.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/plugins/run-program/execute.c b/plugins/run-program/execute.c
index 3d04501..102ab74 100644
--- a/plugins/run-program/execute.c
+++ b/plugins/run-program/execute.c
@@ -236,7 +236,7 @@ execute_with_terminal (RunProgramPlugin *plugin,
const gchar *dir, const gchar *cmd, gchar **env)
{
IAnjutaTerminal *term;
- GPid pid = -1;
+ GPid pid = 0;
gchar* launcher_path = g_find_program_in_path("anjuta-launcher");
gchar *new_cmd;
RunProgramChild *child;
@@ -293,6 +293,7 @@ execute_with_terminal (RunProgramPlugin *plugin,
{
child->source = g_child_watch_add (pid, on_child_terminated, plugin);
}
+
g_strfreev (argv);
}
g_free (term_cmd);
@@ -308,9 +309,19 @@ execute_with_terminal (RunProgramPlugin *plugin,
child->use_signal = TRUE;
pid = ianjuta_terminal_execute_command (term, dir, new_cmd, env, NULL);
+
g_free (new_cmd);
}
- child->pid = pid;
+
+ if (pid > 0)
+ {
+ child->pid = pid;
+ }
+ else
+ {
+ on_child_terminated (0, 0, plugin);
+ pid = 0;
+ }
return pid;
}
@@ -346,6 +357,7 @@ execute_without_terminal (RunProgramPlugin *plugin,
}
else
{
+ on_child_terminated (0, 0, plugin);
pid = 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]