Read stdin in main thread to make exiting easier