optimize read_position_local: pexpect buffer and timout