babashka-sci-dev 2023-08-01

Hi, @borkdude - I think I found some extreme edge-cases on nbb nREPL. Basically, if I connect to nREPL, evaluate something, and immediately disconnect (without waiting for the REPL to send the responses) it crashes with:

node:events:505
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
Emitted 'error' event on Socket instance at:
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -104,
  code: 'ECONNRESET',
  syscall: 'read'
}
Not really a problem because I fixed on my end (it was actually a somewhat annoying behavior that was causing some undesired logs on my tests) but I decided to inform anyway, if it's something you want to fix 🙂

nice, feel free to make a github issue with nbb

Ok, done 🙂

Another question: does bb or nbb support the :line option for nRepl eval? I am seeing some weird behavior, still not sure if it's on my end or not (basically, the line is being ignored)

Feel free to post issues about the nREPL line thing

Metadata? It seems that's explicit on line 150, right? Where it says (.setLineNumber (if (and line (or eval-file (not= pre-line line))) line line-number))

I'll post issues, thanks! Just wanted to be sure it was nothing on my end 🙂

What does it do?

:line sets the current line. So if I evaluate (defn something []) and say that :line 3, the metadata for #'something will say that it was defined on line 3