No need to convert cmd to a tuple, that is done by Linter.get_cmd()
Use with to close the temp file immediately, otherwise it waits until garbage collection
Use try/finally to ensure the temp directory is removed no matter what