node-nrepl-client icon indicating copy to clipboard operation
node-nrepl-client copied to clipboard

how do I feed in input after (read-line)

Open cultofmetatron opened this issue 10 years ago • 0 comments

I'm trying to feed in (read-line) then input the value and print the result. Unfortunately the input does not get assigned to aba. What I'm doing wrong?

nreplClient = require 'nrepl-client'
PORT = 49653

client = nreplClient.connect(port: PORT)
client.once 'connect', () ->
  expr = '(def aba (read-line)) (def doo (read-line))'
  client.eval expr, (err, result) ->
    console.log(expr, err or result)
    client.stdin "5\n", (err, result) ->
      console.log('5', err or result)
      client.eval '(str "hello" aba)', (err, result) ->
        console.log('(str "hello" aba)', err or result)
        client.end()

client.on "error", (err) ->
  console.error("error in nREPL client connection: ", err)

cultofmetatron avatar Jun 04 '15 07:06 cultofmetatron