from unittest.mock import call


def _lcall(command, job_id):
    """
    Call an executable and return a tuple of exitcode, stdout&stderr
    """

    # Write output to a file so we can see what's going on while it's running
    f = "/tmp/%s.out" % job_id

    with open(f, "w", buffering=1) as log:  # Max buffer 1 line (text mode)
        exit_value = call(command, stdout=log, stderr=log)
    return exit_value, f