summaryrefslogtreecommitdiffhomepage
path: root/mixlib
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2006-08-08 00:22:15 +0000
committerJose Antonio Ortega Ruiz <jao@gnu.org>2006-08-08 00:22:15 +0000
commit375187b866499e37817e2781e076b3460c2a3a1a (patch)
tree1efec15d9f2924acf739d114ff899758b7e9d6ec /mixlib
parentcf35b1165b47dfb4c57cff1014476a3ddc886675 (diff)
downloadmdk-375187b866499e37817e2781e076b3460c2a3a1a.tar.gz
mdk-375187b866499e37817e2781e076b3460c2a3a1a.tar.bz2
External programs management improvement
- External programs (editor and mixasm) execution is more robustly controlled both in mixvm and gmixvm. - In gmixvm the external programs dialog has been revamped: - Only proper paths can be introduced for the executables (via a graphical file chooser). - Flags for mixasm are no longer free text, but a check button. - Internally, the code has been refactored. git-archimport-id: mdk@sv.gnu.org/mdk--devel--1--patch-28
Diffstat (limited to 'mixlib')
-rw-r--r--mixlib/xmix_vm_handlers.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/mixlib/xmix_vm_handlers.c b/mixlib/xmix_vm_handlers.c
index 4ebfc77..689a3a6 100644
--- a/mixlib/xmix_vm_handlers.c
+++ b/mixlib/xmix_vm_handlers.c
@@ -286,10 +286,38 @@ cmd_compile_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg)
else
{
gchar *cmd = g_strdup_printf (dis->assembler, arg);
+ gchar *errors = NULL;
+ gchar *output = NULL;
+ gint exit_status;
+ gboolean result;
+ GError *gerr = NULL;
+
if (wants_logs_ (dis)) log_message_ (dis, cmd);
- if (system (cmd) == EXIT_SUCCESS && wants_logs_ (dis))
- log_message_ (dis, _("Successful compilation"));
+
+ result =
+ g_spawn_command_line_sync (cmd, &output, &errors, &exit_status, &gerr);
+
+ if (output)
+ {
+ log_message_ (dis, output);
+ }
+
+ if (errors != NULL)
+ {
+ log_message_ (dis, errors);
+ }
+ else if ((exit_status != 0) || !result)
+ {
+ log_error_ (dis, _("Compilation failed"));
+ if (gerr && gerr->message) log_error_ (dis, gerr->message);
+ }
+
+ if (gerr) g_free (gerr);
+ if (output) g_free (output);
+ if (errors) g_free (errors);
+
g_free (cmd);
+
return TRUE;
}
}