aboutsummaryrefslogtreecommitdiff
path: root/client/acronc/handler_stdin.c
diff options
context:
space:
mode:
Diffstat (limited to 'client/acronc/handler_stdin.c')
-rw-r--r--client/acronc/handler_stdin.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/client/acronc/handler_stdin.c b/client/acronc/handler_stdin.c
index 4b8d0b8..fb7c87c 100644
--- a/client/acronc/handler_stdin.c
+++ b/client/acronc/handler_stdin.c
@@ -59,7 +59,11 @@ static void on_stdin(uv_stream_t *t, ssize_t nread, const uv_buf_t *buf) {
uv_close((uv_handle_t *) t, on_close);
return;
}
+#ifdef _WIN32
+ buf->base[nread - 2] = '\0'; /* Remove junk and tailing \r\n */
+#else
buf->base[nread - 1] = '\0'; /* Remove junk and tailing \n */
+#endif
if ((++ id) > INT_MAX) {
id = 0;
}
@@ -90,4 +94,4 @@ int h_stdin(int (*on_input)(ac_request_t *req),
if ((r = uv_tty_init(loop, &tty, 0, 0))) return r;
if ((r = stdin_start())) return r;
return 0;
-} \ No newline at end of file
+}