diff options
Diffstat (limited to 'apps/plugins/lua')
-rwxr-xr-x | apps/plugins/lua/rbdefines_helper.pl | 1 | ||||
-rw-r--r-- | apps/plugins/lua/rocklua.c | 12 |
2 files changed, 10 insertions, 3 deletions
diff --git a/apps/plugins/lua/rbdefines_helper.pl b/apps/plugins/lua/rbdefines_helper.pl index e788855e87..5fb0946a6a 100755 --- a/apps/plugins/lua/rbdefines_helper.pl +++ b/apps/plugins/lua/rbdefines_helper.pl | |||
@@ -50,6 +50,7 @@ if ($def_type eq "rb_defines") { | |||
50 | '^SYS_(TIMEOUT|POWEROFF|BATTERY_UPDATE)$', | 50 | '^SYS_(TIMEOUT|POWEROFF|BATTERY_UPDATE)$', |
51 | '^SYS_USB_(DIS|)CONNECTED$', | 51 | '^SYS_USB_(DIS|)CONNECTED$', |
52 | '^HOME_DIR$', | 52 | '^HOME_DIR$', |
53 | '^PLUGIN(_OK|_USB_CONNECTED|_POWEROFF|_GOTO_WPS|_GOTO_PLUGIN)$', | ||
53 | '^PLUGIN_DIR$', | 54 | '^PLUGIN_DIR$', |
54 | '^PLUGIN(_APPS_|_GAMES_|_)DATA_DIR$', | 55 | '^PLUGIN(_APPS_|_GAMES_|_)DATA_DIR$', |
55 | '^ROCKBOX_DIR$', | 56 | '^ROCKBOX_DIR$', |
diff --git a/apps/plugins/lua/rocklua.c b/apps/plugins/lua/rocklua.c index 3909f3008f..3cf0fce945 100644 --- a/apps/plugins/lua/rocklua.c +++ b/apps/plugins/lua/rocklua.c | |||
@@ -175,9 +175,10 @@ static int loadfile_newstate(lua_State **L, const char *filename) | |||
175 | static void lua_atexit(void) | 175 | static void lua_atexit(void) |
176 | { | 176 | { |
177 | char *filename; | 177 | char *filename; |
178 | 178 | int err_n; | |
179 | if(Ls && lua_gettop(Ls) > 1) | 179 | if(Ls && lua_gettop(Ls) > 1) |
180 | { | 180 | { |
181 | err_n = lua_tointeger(Ls, -1); /* os.exit? */ | ||
181 | if (Ls == lua_touserdata(Ls, -1)) /* signal from restart_lua */ | 182 | if (Ls == lua_touserdata(Ls, -1)) /* signal from restart_lua */ |
182 | { | 183 | { |
183 | filename = (char *) malloc((MAX_PATH * 2) + 1); | 184 | filename = (char *) malloc((MAX_PATH * 2) + 1); |
@@ -195,7 +196,12 @@ static void lua_atexit(void) | |||
195 | free(filename); | 196 | free(filename); |
196 | plugin_start(NULL); | 197 | plugin_start(NULL); |
197 | } | 198 | } |
198 | else if (lua_tointeger(Ls, -1) != 0) /* os.exit */ | 199 | else if (err_n >= PLUGIN_USB_CONNECTED) /* INTERNAL PLUGIN RETVAL */ |
200 | { | ||
201 | lua_close(Ls); | ||
202 | _exit(err_n); /* don't call exit handler */ | ||
203 | } | ||
204 | else if (err_n != 0) | ||
199 | { | 205 | { |
200 | ERR_RUN: | 206 | ERR_RUN: |
201 | lu_status = LUA_ERRRUN; | 207 | lu_status = LUA_ERRRUN; |
@@ -205,7 +211,7 @@ ERR_RUN: | |||
205 | else | 211 | else |
206 | lua_close(Ls); | 212 | lua_close(Ls); |
207 | } | 213 | } |
208 | _exit(0); /* don't call exit handler */ | 214 | _exit(PLUGIN_OK); /* don't call exit handler */ |
209 | } | 215 | } |
210 | 216 | ||
211 | /* split filename at argchar | 217 | /* split filename at argchar |