Changeset 42

Show
Ignore:
Timestamp:
06/07/06 18:03:15 (2 years ago)
Author:
mk
Message:

Catch an exception when pylint is not found (patch contributed by Ben Leslie).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/mk/cheesecake/_util.py

    r40 r42  
    1919 
    2020import os, sys 
    21 from subprocess import call, Popen, PIPE, STDOUT 
     21from subprocess import call, ProcessError, Popen, PIPE, STDOUT 
    2222 
    2323PAD_TEXT = 40 
     
    2929    """ 
    3030    arglist = cmd.split() 
    31     p = Popen(arglist, stdout=PIPE, stderr=STDOUT) 
     31    try: 
     32        p = Popen(arglist, stdout=PIPE, stderr=STDOUT) 
     33    except ProcessError, e: 
     34        return 1, e 
    3235    output = p.communicate()[0] 
    3336    return p.returncode, output 
  • branches/mk/cheesecake/subprocess.py

    r10 r42  
    394394    import pickle 
    395395 
    396 __all__ = ["Popen", "PIPE", "STDOUT", "call"
     396__all__ = ["Popen", "PIPE", "STDOUT", "call", "ProcessError"
    397397 
    398398try: 
     
    495495    return ''.join(result) 
    496496 
     497class ProcessError(Exception): 
     498    """This exception is raised when there is an error calling 
     499    a subprocess.""" 
     500    pass 
    497501 
    498502class Popen(object): 
     
    984988            if data != "": 
    985989                child_exception = pickle.loads(data) 
    986                 raise child_exception 
     990                raise ProcessError, child_exception 
    987991 
    988992