branch: elpa/idris-mode
commit b80e07174591a912df67979f87701b55ed660d23
Author: Marek L <[email protected]>
Commit: Marek L <[email protected]>
Use string-bytes to compute length of message to Idris
Non-ASCII text uses multiple bytes (e.g. "ab" → 2 bytes, "你好" → 6 bytes in
UTF-8).
Idris process the data "in bytes"" and when using `lenght` we were declaring
incorrect length of the message causing Idris to get stuck in an infinite
loop
Output from strace:
```
read(5, "000017((:interpret \"\344\275\240\345\245\275\") 19)"..., 4096) =
33
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, {tv_sec=0, tv_nsec=626738303}) = 0
lseek(5, -4, SEEK_CUR) = -1 ESPIPE (Illegal seek)
lseek(5, -4, SEEK_CUR) = -1 ESPIPE (Illegal seek)
lseek(5, -4, SEEK_CUR) = -1 ESPIPE (Illegal seek)
lseek.. forever
```
Fixes: https://github.com/idris-hackers/idris-mode/issues/657
---
inferior-idris.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/inferior-idris.el b/inferior-idris.el
index b53e10cfb01..adf33411120 100644
--- a/inferior-idris.el
+++ b/inferior-idris.el
@@ -196,7 +196,7 @@ This is maintained to restart Idris when the arguments
change.")
(defun idris-send (sexp proc)
"Send a SEXP to Idris over the PROC. This is the lowest level of
communication."
(let* ((msg (concat (idris-prin1-to-string sexp) "\n"))
- (string (concat (idris-encode-length (length msg)) msg)))
+ (string (concat (idris-encode-length (string-bytes msg)) msg)))
(idris-event-log sexp t)
(process-send-string proc string)))