Closed Emik03 closed 1 year ago
Howdy. This is not something that's really supported by CSharpRepl -- possibly it's a better fit for dotnet-script?
It probably shouldn't throw an exception, though, so that could definitely be improved. I'll leave this open to have some sort of sensible behavior here. Thanks!
Ah, it does appear to be a better fit, but considering it's essentially 1 implementation detail from working, I don't see why not to implement it anyway while you're already working on preventing the exception from occuring.
Plus, it doesn't support preview features, which is a bit of a bummer too considering I just made the full switch to it.
I'll add stdin support; you're right it's a very easy feature to add. I might not document it as a fully supported scenario, though, because I'm not really wanting to turn CSharpRepl into a scriptCS / dotnet-script environment.
Alright, thank you so much, and good luck with the implementation!
Hi, this is now available in the main
branch. I'm looking at getting a few other fixes in before making a release. Thanks for opening the issue with this suggestion!
Version
0.6.3
What happened?
Run any of
echo "Hello, World!" | csharprepl
,csharprepl </dev/null
, or otherwise redirects the standard input in any way.Expected
Detect that stdin is redirected, then if possible, collect stdin in its entirety, evaluate it, then exit. Otherwise, print to stderr along the lines of "Cannot read redirected stdin", and exit.
If this feature is supported, it should be mentioned that the case of
yes | csharprepl
can happen. I suppose freezing indefinitely is the only logical output as it collectsyyyyyyyyyy
... forever until memory runs out.Actual
Throws an exception.