Console App Basics... quitting possible?

I’ve got a basic behavior I’d like to implement in a console app:

to quit if no input is received within a given amount of time.

Is this even possible? I had this in the main run event, and have tried moving it out to a it’s own thread:

Dim sLine As String = Stdin.ReadLine

But I can’t release the process. Once input is asked for, is there any way to just quit? Quit in the main thread won’t quit. Thread.Kill followed by quit won’t quit. Changing the Stdin to read characters won’t allow the process to quit until the requested number of chars are received. It simply doesn’t appear to be possible, yet the behavior is trivial: no key press after awhile, just quit.

Alternatively, I’ve thought about suicide; But is there any cross platform way I can find the process id of myself (the running console app) to shell a kill command?

As a test, I tried this code:

  dim t as new Class1
  t.Period = 1000
  t.Mode = 2
  
  App.LastInput = Microseconds
  dim s as string
  dim lastS as string
  do
    s = s + StdIn.ReadAll
    if StrComp( s, lastS, 0 ) <> 0 then
      App.LastInput = Microseconds
      lastS = s
    else
      App.DoEvents
    end if
  loop until s.Right( 1 ) = "x"
  
  print s
  return 0

Class1 is a Timer and it’s Action is:

  if ( Microseconds - App.LastInput ) > 5000000. then
    Quit
  end if

This worked perfectly for me. The app would run until an “x” is entered or 5 seconds has elapsed.

I would have NEVER been able to find out about ReadAll’s non-blocking behavior as it’s NOT DOCUMENTED for StdIn, StandardInputStream, or Readable classes. I hope it’s supported long term!

Awesome thank you Kem Tekinay!

I pointed this out to Paul so I expect the documentation will be updated soon.