[Tarantool-patches] [PATCH 1/1] app: exit gracefully when a main script throws an error

Alexander Turenko alexander.turenko at tarantool.org
Thu Oct 24 03:21:56 MSK 2019


I know, the patch was already pushed, but I looked on it briefly anyway.

It is LGTM, however I have one question: see below.

WBR, Alexander Turenko.

> @@ -678,6 +686,12 @@ tarantool_lua_run_script(char *path, bool interactive,
>  		ev_run(loop(), 0);
>  	/* The fiber running the startup script has ended. */
>  	script_fiber = NULL;
> +	/*
> +	 * Result can't be obtained via fiber_join - script fiber
> +	 * never dies if os.exit() was called. This is why diag
> +	 * is checked explicitly.
> +	 */
> +	return diag_is_empty(diag_get()) ? 0 : -1;

This is the only part I'm a bit tentative: can the diagnostic area be
populated by a user somehow? I tried to do--

 | fio.open('non_existent', {'O_RDONLY'})
 | os.exit()

--in the main script and it seems that it uses some other diagnostic
area, because the fio error was not reported as the main script fail.

So, things seems to work good, but I didn't got how exactly.


More information about the Tarantool-patches mailing list