aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2015-03-24 07:45:36 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2015-03-24 10:56:53 -0300
commitd6369707c2ce3570fb25018ba129e6a29bb8b1a1 (patch)
tree2f48b1f6ddfa73fb7de9ac23c6a51343936d90fb /test/functional
parent56ef37eb59c144c6e9ffcd7bcf593c3ac4e836b9 (diff)
downloadrneovim-d6369707c2ce3570fb25018ba129e6a29bb8b1a1.tar.gz
rneovim-d6369707c2ce3570fb25018ba129e6a29bb8b1a1.tar.bz2
rneovim-d6369707c2ce3570fb25018ba129e6a29bb8b1a1.zip
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.
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/job/tty-test.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/functional/job/tty-test.c b/test/functional/job/tty-test.c
index 25e76840aa..b395c9c9a7 100644
--- a/test/functional/job/tty-test.c
+++ b/test/functional/job/tty-test.c
@@ -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);