Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dmypy run when no target given #6153

Merged
merged 8 commits into from
Jan 8, 2019

Conversation

emmatyping
Copy link
Collaborator

dmypy run without a target given will cause the daemon to die unexpectedly on calling mypy.main.process_options with improper arguments.

This catches the SystemExit the argument parser throws and captures sys.stderr for the output of the parser. I had to backport redirect_stderr since that is not available in 3.4, but the backport can be removed in a couple of months when we drop support for 3.4.

I'm not entirely sure if passing the way I'm passing the error messages is a good idea or not, but it certainly is better than dying with just [WinError 233] No process is on the other end of the pipe.

@emmatyping emmatyping requested a review from msullivan January 7, 2019 02:11
Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some nits, otherwise LGTM. Just let's delete the cloned code ASAP.

mypy/dmypy.py Outdated Show resolved Hide resolved
mypy/util.py Show resolved Hide resolved
mypy/dmypy_server.py Outdated Show resolved Hide resolved
mypy/dmypy_server.py Outdated Show resolved Hide resolved
@emmatyping
Copy link
Collaborator Author

Just let's delete the cloned code ASAP.

This won't be a problem, I look forward to taking advantage of some 3.5 features in several places :)

@emmatyping emmatyping merged commit 41d6aea into python:master Jan 8, 2019
@emmatyping emmatyping deleted the daemonsysexit branch January 8, 2019 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants