remove default read buffer size

This prevents newcomers from doing process:read(BUF_SIZE) and cause the
whole process to hang because process:read() accepts a stream parameter
This commit is contained in:
takase1121 2021-07-08 15:23:41 +08:00
parent 8995a2614f
commit d4673f065a
1 changed files with 1 additions and 3 deletions

View File

@ -10,8 +10,6 @@
#include <reproc/reproc.h>
#include "api.h"
#define READ_BUF_SIZE 4096
#define L_GETTABLE(L, idx, key, conv, def) ( \
lua_getfield(L, idx, key), \
conv(L, -1, def) \
@ -230,7 +228,7 @@ static int f_returncode(lua_State *L)
static int g_read(lua_State* L, int stream)
{
process_t* self = (process_t*) lua_touserdata(L, 1);
unsigned long read_size = luaL_optunsigned(L, 2, READ_BUF_SIZE);
unsigned long read_size = luaL_checkunsigned(L, 2);
luaL_Buffer b;
uint8_t* buffer = (uint8_t*) luaL_buffinitsize(L, &b, read_size);