Make awesome.spawn() live up to its documentation
This function is documented to return "an error string if an error occurred". However, the function actually threw a Lua error instead. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
2b6350009e
commit
cc0871498c
10
spawn.c
10
spawn.c
|
@ -397,7 +397,11 @@ parse_command(lua_State *L, int idx, GError **error)
|
|||
{
|
||||
lua_rawgeti(L, idx, i+1);
|
||||
if (lua_type(L, -1) != LUA_TSTRING)
|
||||
luaL_error(L, "Non-string argument at table index %d", i+1);
|
||||
{
|
||||
g_set_error(error, G_SPAWN_ERROR, 0,
|
||||
"Non-string argument at table index %zd", i+1);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* From this point on nothing can go wrong and so we can safely allocate
|
||||
|
@ -412,7 +416,9 @@ parse_command(lua_State *L, int idx, GError **error)
|
|||
}
|
||||
else
|
||||
{
|
||||
luaL_error(L, "Invalid argument to spawn(), expect string or table");
|
||||
g_set_error_literal(error, G_SPAWN_ERROR, 0,
|
||||
"Invalid argument to spawn(), expect string or table");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return argv;
|
||||
|
|
Loading…
Reference in New Issue