def save_results(vcs, signature, result_path, patterns):
results_directory = _get_results_directory(vcs, signature)<EOL>if not os.path.exists(results_directory):<EOL><INDENT>os.makedirs(results_directory)<EOL><DEDENT>with open(os.path.join(results_directory, '<STR_LIT>'), '<STR_LIT:w>') as f:<EOL><INDENT>f.write('<STR_LIT:\n>'.join(patterns))<EOL><DEDENT>if not os.path.exists(os.path.join(results_directory, '<STR_LIT>')):<EOL><INDENT>os.mkdir(os.path.join(results_directory, '<STR_LIT>'))<EOL><DEDENT>includes = ['<STR_LIT>'.format(x)<EOL>for x in patterns]<EOL>cmd = ['<STR_LIT>', '<STR_LIT>'] + includes + ['<STR_LIT>',<EOL>os.path.join(result_path, '<STR_LIT>'),<EOL>os.path.join(results_directory, '<STR_LIT>', '<STR_LIT>')]<EOL>subprocess.check_call(cmd)<EOL>
Save results matching `patterns` at `result_path`.

    Args:
        vcs (easyci.vcs.base.Vcs) - the VCS object for the actual project
                                    (not the disposable copy)
        signature (str) - the project state signature
        result_path (str) - the path containing the result, usually
                            a disposable copy of the project
        patterns (str) - `rsync`-compatible patterns matching test results
                         to save.