SystemProgramming
Task: Google Drive
Variant: 9
Use Java, processes and process exit statud for result of function computation.
Done using ProcessBuilder and Thread. Cancellation via periodic user prompt.
- You can't use KeyListener in console.
Source: StackOverflow - You can't listen for a key and prompt parameter as Scanner is blocking input.
I was using separate thread with Scanner to listen for new line with 'q' symbol. Unfortunately, the only way to kill thread is to use flag to check if thread should be running or not. Scanner is blocking input, so sleeping is pointless, as it will be blocked by awaiting Scanner.