|
48 | 48 | ) |
49 | 49 | from mypy.cache import Tag, read_int_list, read_json |
50 | 50 | from mypy.defaults import RECURSION_LIMIT, WORKER_CONNECTION_TIMEOUT, WORKER_IDLE_TIMEOUT |
| 51 | +from mypy.error_formatter import OUTPUT_CHOICES |
51 | 52 | from mypy.errors import CompileError, ErrorInfo, Errors, report_internal_error |
52 | 53 | from mypy.fscache import FileSystemCache |
53 | 54 | from mypy.ipc import IPCException, IPCServer, ready_to_read, receive, send |
@@ -319,24 +320,27 @@ def flush_errors(filename: str | None, new_messages: list[str], is_serious: bool |
319 | 320 | # We never flush errors in the worker, we send them back to coordinator. |
320 | 321 | pass |
321 | 322 |
|
322 | | - return BuildManager( |
323 | | - data_dir, |
324 | | - search_paths, |
325 | | - ignore_prefix=os.getcwd(), |
326 | | - source_set=source_set, |
327 | | - reports=None, |
328 | | - options=options, |
329 | | - version_id=__version__, |
330 | | - plugin=plugin, |
331 | | - plugins_snapshot=snapshot, |
332 | | - errors=ctx.errors, |
333 | | - error_formatter=None, |
334 | | - flush_errors=flush_errors, |
335 | | - fscache=ctx.fscache, |
336 | | - stdout=sys.stdout, |
337 | | - stderr=sys.stderr, |
338 | | - parallel_worker=True, |
339 | | - ) |
| 323 | + try: |
| 324 | + return BuildManager( |
| 325 | + data_dir, |
| 326 | + search_paths, |
| 327 | + ignore_prefix=os.getcwd(), |
| 328 | + source_set=source_set, |
| 329 | + reports=None, |
| 330 | + options=options, |
| 331 | + version_id=__version__, |
| 332 | + plugin=plugin, |
| 333 | + plugins_snapshot=snapshot, |
| 334 | + errors=ctx.errors, |
| 335 | + error_formatter=None if options.output is None else OUTPUT_CHOICES.get(options.output), |
| 336 | + flush_errors=flush_errors, |
| 337 | + fscache=ctx.fscache, |
| 338 | + stdout=sys.stdout, |
| 339 | + stderr=sys.stderr, |
| 340 | + parallel_worker=True, |
| 341 | + ) |
| 342 | + except CompileError: |
| 343 | + return None |
340 | 344 |
|
341 | 345 |
|
342 | 346 | def console_entry() -> None: |
|
0 commit comments