@wanpeebaw has joined the channel
It sounds like you want something like input-port-append
https://docs.racket-lang.org/reference/port-lib.html#(def._((lib._racket%2Fport..rkt)._input-port-append)) — but I don’t see how this could work without help from the OS/shell, providing you both ports, or doing the concatenation to one, for you? Is there some Bash or whatever construct that does this, e.g. cat "foo" <<some-magic-thing-that-means-stdin>> \| racket myscript.rkt
?
My shell fu is weak. I guess for cat
, -
is the magic thing meaning stdin.
But you can’t cat
"hello"
, just a file or -
. So some other trick is needed.
I think something like cat <(echo "hello") - \| racket myscript.rkt
would work, although that uses process substitution.
As far as I know there’s no good way to do this. Note that with greg’s solution, Racket’s stdin will not be a tty, so useful things like readline won’t work.
Is there a reason not to pass the extra input as a command line argument?
Process substitution, which Greg mentioned, seems like a nice way of handling pipelined inputs (even multiple inputs) without interfering with the controlling terminal. (Neat!)