edi_exe: fix bad bugs.

Make sure we're handling the right process. Also clean-up the
sockets manually. Also make sure we actually do ninja's
clean, otherwise we might be waiting for a long time.
This commit is contained in:
Al Poole 2017-09-21 00:54:01 +01:00
parent 02525fe8ad
commit d6b38524b9
3 changed files with 29 additions and 7 deletions

View File

@ -48,7 +48,7 @@ static Elm_Object_Item *_edi_logpanel_item, *_edi_consolepanel_item, *_edi_testp
static Elm_Object_Item *_edi_selected_bottompanel;
static Evas_Object *_edi_filepanel, *_edi_filepanel_icon;
static Evas_Object *_edi_menu_undo, *_edi_menu_redo, *_edi_toolbar_undo, *_edi_toolbar_redo;
static Evas_Object *_edi_menu_undo, *_edi_menu_redo, *_edi_toolbar_undo, *_edi_toolbar_redo, *_edi_toolbar_build, *_edi_toolbar_test;
static Evas_Object *_edi_menu_build, *_edi_menu_clean, *_edi_menu_test;
static Evas_Object *_edi_menu_init, *_edi_menu_commit, *_edi_menu_push, *_edi_menu_pull, *_edi_menu_status, *_edi_menu_stash;
static Evas_Object *_edi_menu_save, *_edi_toolbar_save;
@ -700,6 +700,8 @@ _edi_launcher_run(Edi_Project_Config_Launch *launch)
static void
_edi_build_menu_items_disabled_set(Eina_Bool state)
{
elm_object_disabled_set(_edi_toolbar_build, state);
elm_object_disabled_set(_edi_toolbar_test, state);
elm_object_disabled_set(_edi_menu_build, state);
elm_object_disabled_set(_edi_menu_test, state);
elm_object_disabled_set(_edi_menu_clean, state);
@ -1218,8 +1220,8 @@ edi_toolbar_setup(Evas_Object *parent)
tb_it = elm_toolbar_item_append(tb, "separator", "", NULL, NULL);
elm_toolbar_item_separator_set(tb_it, EINA_TRUE);
_edi_toolbar_item_add(tb, "system-run", _("Build"), _tb_build_cb);
_edi_toolbar_item_add(tb, "media-record", _("Test"), _tb_test_cb);
_edi_toolbar_build = _edi_toolbar_item_add(tb, "system-run", _("Build"), _tb_build_cb);
_edi_toolbar_test = _edi_toolbar_item_add(tb, "media-record", _("Test"), _tb_test_cb);
_edi_toolbar_item_add(tb, "media-playback-start", _("Run"), _tb_run_cb);
_edi_toolbar_item_add(tb, "utilities-terminal", _("Debug"), _tb_debug_cb);

View File

@ -165,7 +165,7 @@ _meson_clean(void)
{
Meson_Data *md = _meson_data_get();
if (!_meson_configured_check(md->fulldir)) return;
//if (!_meson_configured_check(md->fulldir)) return;
_meson_ninja_do(md, "clean");
}

View File

@ -13,6 +13,9 @@
typedef struct _Edi_Exe_Args {
void ((*func)(int, void *));
void *data;
pid_t pid;
char *path;
Ecore_Con_Server *srv;
Ecore_Event_Handler *handler;
} Edi_Exe_Args;
@ -30,6 +33,19 @@ _edi_exe_notify_data_cb(void *data, int type EINA_UNUSED, void *event EINA_UNUSE
args->func(*status, args->data);
/* Manually cleaning up??? */
if (ecore_con_server_fd_get(args->srv) != -1)
close(ecore_con_server_fd_get(args->srv));
if (ecore_con_client_fd_get(ev->client) != -1)
close(ecore_con_client_fd_get(ev->client));
if (args->path)
{
if (ecore_file_exists(args->path))
unlink(args->path);
free(args->path);
}
free(args);
return ECORE_CALLBACK_DONE;
@ -41,7 +57,6 @@ edi_exe_notify_handle(const char *name, void ((*func)(int, void *)), void *data)
Ecore_Con_Server *srv;
Edi_Exe_Args *args;
/* These are UNIX domain sockets, no need to clean up */
srv = ecore_con_server_add(ECORE_CON_LOCAL_USER, name, 0, NULL);
if (!srv)
return EINA_FALSE;
@ -49,6 +64,8 @@ edi_exe_notify_handle(const char *name, void ((*func)(int, void *)), void *data)
args = malloc(sizeof(Edi_Exe_Args));
args->func = func;
args->data = data;
args->path = ecore_con_local_path_new(EINA_FALSE, name, 0);
args->srv = srv;
args->handler = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, (Ecore_Event_Handler_Cb) _edi_exe_notify_data_cb, args);
return EINA_TRUE;
@ -65,9 +82,10 @@ _edi_exe_event_done_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event
ev = event;
if (!ev->exe) return ECORE_CALLBACK_RENEW;
if (ecore_exe_pid_get(ev->exe) != args->pid) return ECORE_CALLBACK_RENEW;
name = args->data;
/* These are UNIX domain sockets, no need to clean up */
srv = ecore_con_server_connect(ECORE_CON_LOCAL_USER, name, 0, NULL);
if (srv)
{
@ -85,15 +103,17 @@ _edi_exe_event_done_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event
EAPI void
edi_exe_notify(const char *name, const char *command)
{
Ecore_Exe *exe;
Edi_Exe_Args *args;
ecore_exe_pipe_run(command,
exe = ecore_exe_pipe_run(command,
ECORE_EXE_PIPE_READ_LINE_BUFFERED | ECORE_EXE_PIPE_READ |
ECORE_EXE_PIPE_ERROR_LINE_BUFFERED | ECORE_EXE_PIPE_ERROR |
ECORE_EXE_PIPE_WRITE | ECORE_EXE_USE_SH, NULL);
args = malloc(sizeof(Edi_Exe_Args));
args->data = (char *)name;
args->pid = ecore_exe_pid_get(exe);
args->handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _edi_exe_event_done_cb, args);
}