Changeset 175

Show
Ignore:
Timestamp:
02/07/07 04:43:44 (5 years ago)
Author:
mk
Message:

Fixed hanging pylint problem (stdout buffer was overflowed and blocked the whole process).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cheesecake/util.py

    r174 r175  
    2525    """ 
    2626    arglist = cmd.split() 
     27 
     28    output = os.tmpfile() 
    2729    try: 
    28         p = Popen(arglist, stdout=PIPE, stderr=STDOUT, env=env) 
     30        p = Popen(arglist, stdout=output, stderr=STDOUT, env=env) 
    2931    except Exception, e: 
    3032        return 1, e 
     
    3436        start = time.time() 
    3537        while p.poll() is None: 
    36             time.sleep(1) 
     38            time.sleep(0.1) 
    3739            if time.time() - start > max_timeout: 
    3840                os.kill(p.pid, signal.SIGINT) 
     
    4042                return 1, "Time exceeded" 
    4143 
    42     output = p.communicate()[0] 
    43     return p.returncode, output 
     44    p.wait() 
     45    output.seek(0) 
     46    return p.returncode, output.read() 
    4447 
    4548def command_successful(cmd): 
     
    5255    """ 
    5356    rc, output = run_cmd(cmd) 
    54     if rc: 
    55         return False 
    56     return True 
     57    return rc == 0 
    5758 
    5859class StdoutRedirector(object): 
  • trunk/tests/unit/test_index_pylint.py

    r174 r175  
    4343        cheesecake = CheesecakeMockup() 
    4444 
    45         # Raise maximum execution time to 5 minutes, so test won't fail 
    46         #   on slower machines. 
    47         index.max_execution_time = 5*60 
    48  
    4945        index.compute_with(cheesecake) 
    5046        assert index.details != "encountered an error during pylint execution"