import pathlib
from typing import List
import asyncio


async def _create_subprocess(program: pathlib.Path, args: List[str]) -> int:
    """Executes a process

    Parameters
    ----------
    program
        path of the executable
    args
        arguments to be passed to the executable

    Returns
    -------
    int
        return code
    """

    process = await asyncio.create_subprocess_exec(*([str(program)] + args))

    return await process.wait()