Permalink
Browse files

shutdown moxi on EOL in addition to EOF

So that erlang can reliably shutdown moxi.

Change-Id: Ie31b4b577a5454115e251c92392306337e6be988
Reviewed-on: http://review.membase.org/6070
Tested-by: Steve Yen <steve.yen@gmail.com>
Reviewed-by: Steve Yen <steve.yen@gmail.com>
  • Loading branch information...
1 parent d4c8d95 commit 1f5d8944127bfcf9164b00eff1e912487524238a Aliaksey Kandratsenka committed with steveyen May 8, 2011
Showing with 6 additions and 4 deletions.
  1. +6 −4 stdin_check.c
View
10 stdin_check.c
@@ -9,14 +9,16 @@
static void* check_stdin_thread(void* arg)
{
+ int ch;
+
(void)arg;
pthread_detach(pthread_self());
- while (!feof(stdin)) {
- getc(stdin);
- }
+ do {
+ ch = getc(stdin);
+ } while (ch != EOF && ch != '\n' && ch != '\r');
- moxi_log_write("EOF on stdin. Exiting\n");
+ fprintf(stderr, "%s on stdin. Exiting\n", (ch == EOF) ? "EOF" : "EOL");
exit(0);
/* NOTREACHED */
return NULL;

0 comments on commit 1f5d894

Please sign in to comment.