inim-repl / INim

Interactive Nim shell / REPL / Playground
MIT License
644 stars 23 forks source link

Assistance for inim input/output in new process #122

Closed Niminem closed 3 years ago

Niminem commented 3 years ago

Hello, I'm building a Jupyter Notebook-like IDE for nim and would like to use Inim for the REPL as opposed to nim secret.

What is best for writing to the input stream and reading from the output stream with Inim, if say, I open Inim in a new process to read/write? I seem to be getting caught in a loop when reading from the output- not quite sure if that's due to data not being passed into the input stream correctly or if I'm not able to read from the output stream at all. Happy to give further details if needed

Niminem commented 3 years ago

In the simple example below I get stuck in some sort of loop. I'll get 'trying to read line' but that's where it ends. I have to ctl+c and kill it

var p = startProcess(command="inim", options = {poUsePath})
var inp = inputStream(p)
var outp = outputStream(p)
var script = "echo 9000\n"
inp.write(script)
inp.flush()
echo "trying to read line"
echo outp.readLine()
echo "read line"