def METHOD_NAME(command_file, specfile):
    """
    Given a file full of commands, applies them line by line to the specfile, replacing the file with stdout.
    """
    with open(command_file, "r") as commands:
        for command in commands:
            command = command.strip().replace("{specfile}", specfile)
            print("Running command: %s" % command)
            with tempfile.NamedTemporaryFile(mode="w", dir=".", delete=False) as tmp:
                subprocess.check_call([command], shell=True, cwd=".", stdout=tmp)
                os.replace(tmp.name, specfile)