in reply to How to know whether user terminates system("$cmd|more") with q or not?
But how to know whether user terminates system("$cmd|more") with q or not in the first place?
There is no (simple*) way to do this. The 'q' character is only seen by the more process and it doesn't share any information about how it is terminated.
The simplest way to achieve something similar would be to use a piped-open to run the command (without using more) and Term::ReadKey to simulate the more commands.
(*) Theoretically it would be possible to have the parent process capture all input from the console and inject it into the child processes input stream, but it would be a substantial amount of very non-trivial coding. Using a piped-open and simulating more is much easier.
|
|---|