-
-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to handle System Input in CLI? #353
Comments
Your solution makes sense to me. Ideally, all of SystemIO would be rewritten to something nicer - i could imagine a solution where a SystemIO class exposes hooks to register streams for the various file descriptors, such that we'd have less control flow specific code in Would you mind elaborating on why you'd change from |
Regarding With the GUI console the while loop in the Keeping the line It's possible that this difference in behavior is due to the special QTextStream created that points to With the method A possible solution arose from reading one character at a time. The number of characters doesn't exceed If you have a better solution, it would be welcome. |
That analysis sounds reasonable to me; as long as we have the solution which provides an intuitive user experience and doesn't deadlock the program with it trying to wait for user input. |
As stated in the current implementation of the
clirunner.cpp
file:Ripes/src/cli/clirunner.cpp
Line 47 in 0faf41b
there is no provision for handling system input from the command-line interface (CLI).
I am working on implementing the capability to accept input from STDIN within the CLI.
I'm focusing on the
systemio.h
file, that contains the methodreadFromFile
, which is called while performing the operation of theReadSyscall
. The methodreadFromFile
extract from a map the stream that needs to be used. There's a special case for the stream0
:STDIN
.My proposal for now consists of:
systemio.h
file. This method sets the stream atSTDIN
position to the standard input.systemio.h
file:clirunner.cpp
file call the new method:Those additions should replace the old input stream (which works for the GUI) and create a new one for the CLI.
Your contributions and feedback on the implementation of this feature are appreciated.
Thanks 😄
The text was updated successfully, but these errors were encountered: