Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'coro-sugar' of github.com:luvit/luvit
- Loading branch information
Showing
3 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,10 @@ | |
#define PATH_MAX (8096) | ||
#endif | ||
|
||
#ifndef MAX_TITLE_LENGTH | ||
#define MAX_TITLE_LENGTH (8192) | ||
#endif | ||
|
||
#ifndef _WIN32 | ||
|
||
const char *luv_signo_string(int signo) { | ||
|
@@ -362,6 +366,26 @@ int luv_execpath(lua_State* L) { | |
return 1; | ||
} | ||
|
||
int luv_get_process_title(lua_State* L) { | ||
char title[8192]; | ||
uv_err_t err = uv_get_process_title(title, 8192); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
rphillips
Member
|
||
if (err.code) { | ||
return luaL_error(L, "uv_get_process_title: %s: %s", uv_err_name(err), uv_strerror(err)); | ||
} | ||
lua_pushstring(L, title); | ||
return 1; | ||
} | ||
|
||
int luv_set_process_title(lua_State* L) { | ||
const char* title = luaL_checkstring(L, 1); | ||
uv_err_t err = uv_set_process_title(title); | ||
if (err.code) { | ||
return luaL_error(L, "uv_set_process_title: %s: %s", uv_err_name(err), uv_strerror(err)); | ||
} | ||
return 0; | ||
} | ||
|
||
|
||
int luv_handle_type(lua_State* L) { | ||
uv_file file = luaL_checkint(L, 1); | ||
uv_handle_type type = uv_guess_handle(file); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I'm curious. Why didn't you use MAX_TITLE_LENGTH macro instead of the literal 8192?