On Wed, 14 Aug 2019 13:33:51 +0200 Pierre Couderc <pie...@couderc.eu> said:

> 
> On 8/14/19 10:15 AM, Carsten Haitzler (The Rasterman) wrote:
> > 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 set up handlers before i run
> > anything to ensure they are in place first... ?
> >
> I had taken the example from 
> https://www.enlightenment.org/_legacy_embed/ecore_exe_example_8c-example.html
> 
> I suggest to modify the exmple to set up the handler before the 
> ecore_exe_pipe_runfor those - like me - who copy/paste without fully 
> thinking...
> 
> (I would have done it myself but I have no acess to this page)

you are printing the raw data blob not the lines and you requested line
buffering in the flags - see the difference? you just never look at the parsed
lines in the event handler cb. if you don't want that then you can use the
ev->data blob and not use that flag (its a binary blob so ensure u nul terminate
it if you want it as a string and want to print it out... - then it contains
whatever data it managed to get that time - maybe cut off mid-line).

adding the event handler after running the exe happens to work because no input
is processed yet until the loop runs. its generally not a good idea though to
do this and always set up handlers first before anything that could trigger
those events.

-- 
------------- 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