discomfitor pushed a commit to branch master.

http://git.enlightenment.org/misc/entrance.git/commit/?id=745ba1e293b9357acad3076e4fd50b2bfaca9fde

commit 745ba1e293b9357acad3076e4fd50b2bfaca9fde
Author: Mike Blumenkrantz <[email protected]>
Date:   Sun May 4 23:57:41 2014 -0400

    launch entrance_client with pipe -> read | error
    
    this is insane. you're really just firing off entrance clients into the 
void and HOPING that they get to the point of launching with no possible way to 
debug failures????
---
 src/daemon/entrance.c | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/src/daemon/entrance.c b/src/daemon/entrance.c
index 64fdfca..d9fff0d 100644
--- a/src/daemon/entrance.c
+++ b/src/daemon/entrance.c
@@ -144,6 +144,34 @@ _entrance_wait(void)
 }
 
 static Eina_Bool
+_entrance_client_error(void *d EINA_UNUSED, int t EINA_UNUSED, 
Ecore_Exe_Event_Data *ev)
+{
+   char buf[4096];
+   size_t size = ev->size;
+
+   if ((unsigned int)ev->size > sizeof(buf) - 1)
+     size = sizeof(buf) - 1;
+
+   strncpy(buf, (char*)ev->data, size);
+   PT("Client error: %s", buf);
+   return ECORE_CALLBACK_DONE;
+}
+
+static Eina_Bool
+_entrance_client_data(void *d EINA_UNUSED, int t EINA_UNUSED, 
Ecore_Exe_Event_Data *ev)
+{
+   char buf[4096];
+   size_t size = ev->size;
+
+   if ((unsigned int)ev->size > sizeof(buf) - 1)
+     size = sizeof(buf) - 1;
+
+   strncpy(buf, (char*)ev->data, size);
+   PT("Client output: %s", buf);
+   return ECORE_CALLBACK_DONE;
+}
+
+static Eina_Bool
 _entrance_main(const char *dname)
 {
    PT("starting...\n");
@@ -154,13 +182,17 @@ _entrance_main(const char *dname)
              char buf[PATH_MAX];
              ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
                                      _entrance_client_del, NULL);
+             ecore_event_handler_add(ECORE_EXE_EVENT_ERROR,
+                                     
(Ecore_Event_Handler_Cb)_entrance_client_error, NULL);
+             ecore_event_handler_add(ECORE_EXE_EVENT_DATA,
+                                     
(Ecore_Event_Handler_Cb)_entrance_client_data, NULL);
              snprintf(buf, sizeof(buf),
                       "sudo -u nobody "
                       PACKAGE_BIN_DIR"/entrance_client -d %s -t %s",
                       dname, entrance_config->theme);
              PT("Exec entrance_client: %s\n", buf);
 
-             _entrance_client = ecore_exe_run(buf, NULL);
+             _entrance_client = ecore_exe_pipe_run(buf, ECORE_EXE_PIPE_READ | 
ECORE_EXE_PIPE_ERROR, NULL);
           }
      }
    else

-- 


Reply via email to