From 375187b866499e37817e2781e076b3460c2a3a1a Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Tue, 8 Aug 2006 00:22:15 +0000 Subject: 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 --- mixlib/xmix_vm_handlers.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'mixlib') 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; } } -- cgit v1.2.3