• Iustin Pop's avatar
    Change IsPidFileAlive into ReadPidFile · d9f311d7
    Iustin Pop authored
    We already have a function to test if a PID is alive, so it makes more
    sense to use function composition that force calling (since we need to
    read PIDs from files in other places too). Now IsProcessAlive returns
    False for PIDs <= 0, since this is the error return from ReadPidFile.
    
    The patch also adds a unittest for checking that WriteFile raises the
    correct exception, and checks that an invalid or missing file causes
    ReadPidFile to return zero. The unittest tearDown method will try to
    cleanup the temp directory too (otherwise it leaves stuff after it).
    
    Reviewed-by: ultrotter
    d9f311d7
utils.py 30.7 KB