static public function cleanup( $opts=array() )
    {
        if ( strtoupper( substr( PHP_OS, 0, 3 ) ) == 'WIN' )
        {
            exec( 'tasklist /FO CSV', $runningProcesses, $return_var );
            $runningProcesses = array_map(
                function( $line ){ $cols = explode( ',', $line ); return trim( $cols[1], '"' ); },
                $runningProcesses );
            unset( $runningProcesses[0] ); // 'PID'
            sort( $runningProcesses );
            unset( $runningProcesses[0] ); // 0
        }
        else
        {
            exec( 'ps -e -o pid', $runningProcesses, $return_var );
        }

        if ( $return_var != 0 )
        {
            pake_echo_error( "Could not get list of processes to remove stale lock files" );
            return;
        }

        $lockDir = self::lockDir( $opts );
        foreach( glob( $lockDir . "/*_W.lock" ) as $writeLock )
        {
            $pid = file_get_contents( $writeLock ); //strstr( file_get_contents( $writeLock ), ' ', true );
            if ( !in_array( $pid, $runningProcesses ) )
            {
                pake_unlink( $writeLock );
            }
        }
        foreach( glob( $lockDir . "/*_R/*.lock" ) as $readLock )
        {
            $pid = file_get_contents( $readLock ); // strstr( file_get_contents( $readLock ), ' ', true );
            if ( !in_array( $pid, $runningProcesses ) )
            {
                pake_unlink( $readLock );
            }
        }
    }