772 | 772 |
file.close()
|
773 | 773 |
os.close(fd)
|
774 | 774 |
# replace all occurrences in command
|
775 | |
command = re.sub(r'\%\(test-body-file\)', test_filename, command)
|
|
775 |
command = command.replace('%(test-body-file)', test_filename)
|
776 | 776 |
command_contained_test_body_file = True
|
777 | 777 |
|
778 | 778 |
if '%(test-body-text)' in self.command:
|
779 | 779 |
# escape all single quotes in body
|
780 | 780 |
body = re.sub(r"'", r"\'", body)
|
781 | 781 |
# replace all occurrences in command
|
782 | |
command = re.sub(r'\%\(test-body-text\)', body, command)
|
|
782 |
command = command.replace('%(test-body-text)', body)
|
783 | 783 |
command_contained_test_body_text = True
|
784 | 784 |
|
785 | 785 |
if '%(test-input-file)' in self.command:
|
|
791 | 791 |
file.close()
|
792 | 792 |
os.close(fd)
|
793 | 793 |
# replace all occurrences in command
|
794 | |
command = re.sub(r'\%\(test-input-file\)', test_input_filename, command)
|
|
794 |
command = command.replace('%(test-input-file)', test_input_filename)
|
795 | 795 |
command_contained_test_input_file = True
|
796 | 796 |
|
797 | 797 |
if '%(test-input-text)' in self.command:
|
798 | 798 |
# escape all single quotes in input
|
799 | 799 |
body = re.sub(r"'", r"\'", body)
|
800 | 800 |
# replace all occurrences in command
|
801 | |
command = re.sub(r'\%\(test-input-text\)', input, command)
|
|
801 |
command = command.replace('%(test-input-text)', input)
|
802 | 802 |
command_contained_test_input_text = True
|
803 | 803 |
|
804 | 804 |
if '%(output-file)' in self.command:
|
|
806 | 806 |
fd, output_filename = mkstemp()
|
807 | 807 |
os.close(fd)
|
808 | 808 |
# replace all occurrences in command
|
809 | |
command = re.sub(r'\%\(output-file\)', output_filename, command)
|
|
809 |
command = command.replace('%(output-file)', output_filename)
|
810 | 810 |
|
811 | 811 |
# subshell the command and return the output
|
812 | 812 |
pipe = Popen(command, shell=True,
|