Streamlined mexext detection, with removal of trailing whitespace/newlines handled by execute_process