On Wed, 14 Aug 2019 07:43:01 +0200 Pierre Couderc <pie...@couderc.eu> said:

> My source is:
> 
> childHandle = ecore_exe_pipe_run("ps aux"),static_cast<Ecore_Exe_Flags>( 
> ECORE_EXE_PIPE_READ_LINE_BUFFERED ), NULL);
>      ecore_event_handler_add(ECORE_EXE_EVENT_DATA, 
> receive_process_messages, data);
> 
> I get no message in "receive_process_messages".
> 
> If I use : ECORE_EXE_PIPE_WRITE | ECORE_EXE_PIPE_READ_LINE_BUFFERED | 
> ECORE_EXE_PIPE_READ, I get a few "lines" : 4 instead of tenths...
> 
> What do I miss ?

do you have other event handlers handling exe event data too? do they return
ECORE_CALLBACK_PASS_ON? here is some basic sample c code that also throws in
handlers for add and del of the exe too and print exit code. I see line
buffered data in multiple events. it takes 5 events to deliver all of the
output. i used /bin/ps to ensure my aliases don't change anything from my user
shell env. i returned ECORE_CALLBACK_PASS_ON to pass the event on to other
event handlers of the same type of event. i set up handlers before i run
anything to ensure they are in place first... ?

------------------------------------------------------------------------------

#include <Eina.h>
#include <Ecore.h>

static Eina_Bool _cb_exe_add(void *data, int type, void *event) {
   Ecore_Exe_Event_Add *ev = event;
   printf("exe add %p\n", ev->exe);
   return ECORE_CALLBACK_PASS_ON;
}

static Eina_Bool _cb_exe_dat(void *data, int type, void *event) {
   Ecore_Exe_Event_Data *ev = event;

   printf("exe data: %p [%p, %i bytes] ...\n", ev->exe, ev->data, ev->size);
   if (ev->lines) {
      for (int i = 0; ev->lines[i].line; i++)
        printf(" exe line %p '%s'\n", ev->exe, ev->lines[i].line);
   }
   return ECORE_CALLBACK_PASS_ON;
}

static Eina_Bool _cb_exe_del(void *data, int type, void *event) {
   Ecore_Exe_Event_Del *ev = event;
   printf("exe del %p exit_code=%i\n", ev->exe, ev->exit_code);
   return ECORE_CALLBACK_PASS_ON;
}

int main(int argc, char **argv) {
   ecore_init();

   ecore_event_handler_add(ECORE_EXE_EVENT_ADD,  _cb_exe_add, NULL);
   ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _cb_exe_dat, NULL);
   ecore_event_handler_add(ECORE_EXE_EVENT_DEL,  _cb_exe_del, NULL);
   Ecore_Exe *exe = ecore_exe_pipe_run("/bin/ps aux",
                                       ECORE_EXE_PIPE_READ_LINE_BUFFERED |
                                       ECORE_EXE_PIPE_READ,
                                       NULL);
   printf("launched exe %p\n", exe);
   ecore_main_loop_begin();
   ecore_shutdown();
}

------------------------------------------------------------------------------

-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
Carsten Haitzler - ras...@rasterman.com



_______________________________________________
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users

Reply via email to