Repository: tursodatabase/limbo (language: rust)

Issue:
Processing JSON from stdin is broken
If I run the following JSON test in interactive mode, it works:

```
limbo % cargo run
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.34s
     Running `target/debug/limbo`
Limbo v0.0.14
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database
limbo> SELECT json(' /* abc */ { /*def*/ aaa /* xyz */ : // to the end of line
          123 /* xyz */ , /* 123 */ }');
{"aaa":123}
```

However, if I try to run the same JSON query through stdin, Limbo complains about malformed JSON:

```
limbo % cat input-json.txt
SELECT json(' /* abc */ { /*def*/ aaa /* xyz */ : // to the end of line
          123 /* xyz */ , /* 123 */ }')
limbo % cat input-json.txt | cargo run
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.47s
     Running `target/debug/limbo`
Limbo v0.0.14
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database
Parse error: malformed JSON
```


Discussion / hints:

Fix patch:
diff --git a/cli/app.rs b/cli/app.rs
index 7941e90e1..8e438cbfa 100644
--- a/cli/app.rs
+++ b/cli/app.rs
@@ -502,7 +502,7 @@ impl Limbo {
             }
             self.reset_input();
         } else {
-            self.buffer_input(line);
+            self.buffer_input(format!("{}\n", line).as_str());
             self.set_multiline_prompt();
         }
         rl.add_history_entry(line.to_owned())?;


Test patch: