> static void
> _exe_exit_eval(Eo *obj, Efl_Exe_Data *pd)
> {
> if ((pd->fd.out == -1) && /*(pd->fd.in == -1) &&*/
> (pd->fd.exited_read == -1) && (!pd->exit_called))
> {
> - Eina_Future *job;
> - Eo *loop = efl_provider_find(obj, EFL_LOOP_CLASS);
> -
> pd->exit_called = EINA_TRUE;
> - efl_ref(obj);
> - job = eina_future_then(efl_loop_job(loop), _efl_loop_task_exit, obj);
> - efl_future_Eina_FutureXXX_then(obj, job);
> + if (pd->promise)
> + {
> + int exit_code = efl_task_exit_code_get(obj);
> + if (exit_code != 0) eina_promise_reject(pd->promise, exit_code
> + 1000000);
> + else eina_promise_resolve(pd->promise, eina_value_int_init(0));
I said I'd give up... but seeing this makes me sad.
in two lines you: misused the Eina_Error AND missed the purpose of resolve.
I hoped when you looked at it, written as code, you'd realize the
mistake... but seems not... so I'm pointing here.
eina_error conversion to string (which will be helpful to high level
languages) is missed, "+ 1000000" is an error that is not
registered...
OTOH success is always ZERO, so there is no value... IF that would be
right, then it should be a void promise (carries no value).
but my hope is that you'll simply move this to
eina_promise_resolve(pd->promise, eina_value_int_init(exit_code))
and listen to my advice that is to move the "!= 0" *OUTSIDE* of this
function, you're mixing roles :-/
at least you could see that eina promise is not that complex... the
only issue remaining is this one I'm pointing you.
I know we don't have the eina_future_cb_compare(), but adding that
will be usable everywhere and make your efl_task interface more
powerful.
> @@ -531,7 +533,7 @@ _efl_exe_efl_task_run(Eo *obj EINA_UNUSED, Efl_Exe_Data
> *pd)
> _exec(cmd, pd->flags);
> // we couldn't exec... uh oh. HAAAAAAAALP!
> exit(-122);
> - return EINA_FALSE;
> + return NULL;
this is one place you could notify the main process and cause it to
reject with the errno.
--
Gustavo Sverzut Barbieri
--------------------------------------
Mobile: +55 (16) 99354-9890
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel