Hi,

On 02 janvier 10:02, A.T.Hofkamp wrote:
> On 12/30/2011 04:51 AM, Derek Harland wrote:
> >+    lintPath = os.path.join(os.path.dirname(__file__), 'lint.py')
> >+    cmd = '%s %s -f parseable -r n --disable=C,R,I "%s"' % (sys.executable, 
> >lintPath, childPath)
> >+    process = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE, 
> >cwd=parentPath)
> 
> While you are at it, you could also drop use of the shell, which is
> safer with respect to shell quoting problems, as in
> 
> cmd = [sys.executable, lintPath, '-f', 'parseable', '-r', 'n', 
> '--disable=C,R,I', childPath]
> process = Popen(cmd, stdout=PIPE, stderr=PIPE, cwd=parentPath)

thank you both for your suggestion. I've turned this into a "real" patch,
if you mind take a look at it before integration: 
http://www.logilab.org/patch/87029

Derek: notice a difference with your patch: instead of printing 'Error + 
statuscode',
I simply made the 'lint' function return the status code, and the Run function
sys.exit with the proper code. That's because pylint exit code will be != 0
according to the messages issued, as explained by pylint --long-help, so I'm 
afraid
this will be wrongly interpreted by users.

Cheers,
-- 
Sylvain Thénault, LOGILAB, Paris (01.45.32.03.12) - Toulouse (09.54.03.55.76)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
CubicWeb, the semantic web framework:    http://www.cubicweb.org
_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to