mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
test: Fix tty-test program
The "tty ready" string must only be printed when the process is ready to receive signals, and this only happens when the event loop has started.
This commit is contained in:
parent
56ef37eb59
commit
d6369707c2
@ -80,6 +80,12 @@ static void read_cb(uv_stream_t *stream, ssize_t cnt, const uv_buf_t *buf)
|
||||
free(buf->base);
|
||||
}
|
||||
|
||||
static void prepare_cb(uv_prepare_t *handle)
|
||||
{
|
||||
fprintf(stderr, "tty ready\n");
|
||||
uv_prepare_stop(handle);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (!is_terminal(stdin)) {
|
||||
@ -98,7 +104,9 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
bool interrupted = false;
|
||||
fprintf(stderr, "tty ready\n");
|
||||
uv_prepare_t prepare;
|
||||
uv_prepare_init(uv_default_loop(), &prepare);
|
||||
uv_prepare_start(&prepare, prepare_cb);
|
||||
uv_tty_t tty;
|
||||
uv_tty_init(uv_default_loop(), &tty, fileno(stderr), 1);
|
||||
uv_read_start((uv_stream_t *)&tty, alloc_cb, read_cb);
|
||||
|
Loading…
Reference in New Issue
Block a user