Extract input handling to os.rs