fortran_with_isolated_cache Function

public function fortran_with_isolated_cache(test_name) result(command_prefix)

Create a command that runs fortrun with isolated cache

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: test_name

Return Value character(len=:), allocatable


Source Code

    function fortran_with_isolated_cache(test_name) result(command_prefix)
        character(len=*), intent(in) :: test_name
        character(len=:), allocatable :: command_prefix
        character(len=:), allocatable :: cache_dir

        ! Create isolated cache directory for this test
        cache_dir = create_test_cache_dir(test_name)

        ! Build command with XDG_CACHE_HOME set
        if (get_os_type() == OS_WINDOWS) then
            ! Windows: use set command inline with proper escaping
            command_prefix = 'cmd /c "set XDG_CACHE_HOME='//trim(escape_quotes(cache_dir))//' && fpm run fortrun --"'
        else
            ! Unix: use environment variable prefix
            command_prefix = 'XDG_CACHE_HOME="'//trim(escape_quotes(cache_dir))//'" fpm run fortrun --'
        end if

    end function fortran_with_isolated_cache