Jonathan Hartley wrote:
For reasons I can't explain, the scripts I describe below work for me. However my foolish intellect insists that perhaps pylint-script.py should actually read:

    import sys
    from pylint import lint
    sys.exit(lint.Run(sys.argv[1:]))

(ie. explicitly calling sys.exit)

The reason you don't have to call sys.exit explicitly is that lint.Run does it already. So even if you write pylint-script.py that way, your sys.exit will never be called because lint.Run will exit before it returns.

Daniel


SUMMARY

Replace the current pylint.bat with:

    @echo off
    python "%~dp0%~n0-script.py" %*

This just executes the file pylint-script.py, in the same directory. This is a new file:

    import sys
    from pylint import lint
    lint.Run(sys.argv[1:])

The result will execute pylint without ever exiting the current shell, and will always propagate the exit value from lint.Run() back to the invoker as a process exit value. As a bonus, despite introducing an extra .py file, this seems a much tidier and more understandable mechanism than the existing pylint.bat.

_______________________________________________
Python-Projects mailing list
Python-Projects@lists.logilab.org
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to