Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion mypy/dmypy_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,11 @@ def cmd_run(
)
if current_plugins_snapshot != start_plugins_snapshot:
return {"restart": "plugins changed"}
return self.check(sources, export_types, is_tty, terminal_width)
except InvalidSourceList as err:
return {"out": "", "err": str(err), "status": 2}
except SystemExit as e:
return {"out": stdout.getvalue(), "err": stderr.getvalue(), "status": e.code}
return self.check(sources, export_types, is_tty, terminal_width)

def cmd_check(
self, files: Sequence[str], export_types: bool, is_tty: bool, terminal_width: int
Expand Down Expand Up @@ -856,6 +856,13 @@ def pretty_messages(

def update_sources(self, sources: list[BuildSource]) -> None:
paths = [source.path for source in sources if source.path is not None]
for path in paths:
if not self.fscache.exists(path):
raise InvalidSourceList(
"mypy: can't read file '{}': No such file or directory\n".format(
path.replace(os.getcwd() + os.sep, "")
)
)
if self.following_imports():
# Filter out directories (used for namespace packages).
paths = [path for path in paths if self.fscache.isfile(path)]
Expand Down
Loading