If anyone has ideas. They would be much appreciate a bit of help.
Somehow, updating how we use tcp streams broke stdin.
This commit: https://github.com/roc-lang/basic-cli/commit/b495041380615814bc2f163e0f1f61bfac39bf54
from the automatic-file-closing branch on basic cli. only touches tcp streams.
Somehow, whenever reading stdin on this branch, it immediately gets EOF.
There is a chance that I did something unsafe with pointers and it broke stdin, but that would surprise me.
valgrind
doesn't find anything.
Trying to debug this a bit more, It seems that allocating a buffered tcp stream into the heap is where the issue arises. It kinda feels like I use the mmap and then stdin suddenly has no data anymore.
Makes me feel like I might be writing to entirely the wrong location and breaking something, but from what I can tell, I am correctly writing into the mmap.
hmm, actually the error comes through in roc, so it may be delayed.
Actually seems nondeterministic depending on the exact build config. All roc refcount prints look correct....still very lost.
Definitely a spooky action at a distance kinda bug that feels like a I rolled the dice and uncovered something that has always been broken rather than something this commit broke, but not sure.
For now, just decided to revert the tcp change and move on.
So just looking at files then?
Yeah, updating files to automatically close and adding in mmap
Last updated: Jul 05 2025 at 12:14 UTC