core: cleaner method of mirroring stdin for Windows