defuz / RustAutoComplete

A SublimeText binding for RACER (Rust auto completion tool)
MIT License
105 stars 20 forks source link

Check if racer executable exist before run racer #43

Open yxnan opened 3 years ago

yxnan commented 3 years ago

In the original version, if racer does not exist, the call to racer Popen(cmd_list, stdout=PIPE, stderr=PIPE, env=env, startupinfo=startupinfo) will raise a FileNotFoundError and get caught by upper caller on_query_completions.

The problem here is, once the error is raised, run_racer returns immediately and skipped os.remove(temp_file_path), therefore the temporary file doesn't get deleted and piles up.

Screenshot: tmp files can't get cleaned

By checking the existence of racer before any work begins, we can avoid the creation of temp files