Closed GoogleCodeExporter closed 9 years ago
Hello,
did you noticed all the -ERR? :)
You are talking the protocol in the wrong way, please check the protocol
specification for more information.
Regards,
Salvatore
Original comment by anti...@gmail.com
on 29 Apr 2010 at 8:49
That's a good point, I was thinking in terms of redis-cli...
Could I offer the following patch to linenoise.c, so it's possible to pipe to
it like I tried to originally? :)
diff --git a/linenoise.c b/linenoise.c
index 4e17da2..fbe5e7d 100644
--- a/linenoise.c
+++ b/linenoise.c
@@ -336,15 +336,24 @@ up_down_arrow:
static int linenoiseRaw(char *buf, size_t buflen, const char *prompt) {
int fd = STDIN_FILENO;
int count;
+ char *end;
if (buflen == 0) {
errno = EINVAL;
return -1;
}
- if (enableRawMode(fd) == -1) return -1;
- count = linenoisePrompt(fd, buf, buflen, prompt);
- disableRawMode(fd);
- printf("\n");
+ if (enableRawMode(fd) == -1) {
+ /* not a terminal, fall back to fgets. */
+ if (fgets(buf, buflen, stdin) == NULL)
+ return -1;
+ end = strchr(buf, '\n');
+ *end = '\0';
+ count = strlen(buf);
+ } else {
+ count = linenoisePrompt(fd, buf, buflen, prompt);
+ disableRawMode(fd);
+ printf("\n");
+ }
return count;
}
(Sorry to change the issue slightly.)
Original comment by dgl...@gmail.com
on 29 Apr 2010 at 11:42
Hello, thanks, I did not applied the exact patch but the result is the same ;)
Thanks!
Salvatore
Original comment by anti...@gmail.com
on 30 Apr 2010 at 7:22
Original comment by pcnoordh...@gmail.com
on 26 Jun 2010 at 9:54
Original issue reported on code.google.com by
dgl...@gmail.com
on 29 Apr 2010 at 8:46