Path: blob/main/core/libedit/src/readline.patch
1396 views
I don't understand why, but I had to make a small change in order to get1control+d to work properly with Python + WASI. For some reason2e->el_tty.t_c[TS_IO] is just all zeros, whereas e->el_tty.t_c[EX_IO] is3interesting. Reading all the code (!), it makes way more sense to me4to consider e->el_tty.t_c[EX_IO] rather than e->el_tty.t_c[TS_IO].5Maybe this is just a decades old bug in libedit, and people usually use6readline, so they don't notice. I don't know.78I found that using e->el_tty.t_c[EX_IO][C_EOF] led to a lot of problems in9various states as well after revamping our IO and refactoring code. I'm10now just hardcoding the number 4, which seems to work very well in all cases for us.1112--- readline-orig.c 2022-07-20 16:28:37.000000000 -070013+++ readline.c 2022-07-20 16:49:05.000000000 -070014@@ -2112,7 +2112,7 @@15el_set(e, EL_UNBUFFERED, 1);16if (buf == NULL || count-- <= 0)17return;18- if (count == 0 && buf[0] == e->el_tty.t_c[TS_IO][C_EOF])19+ if (count == 0 && buf[0] == 4)20done = 1;21if (buf[count] == '\n' || buf[count] == '\r')22done = 2;232425