| 7756 | } |
| 7757 | |
| 7758 | static char *run_textconv(struct repository *r, |
| 7759 | const char *pgm, |
| 7760 | struct diff_filespec *spec, |
| 7761 | size_t *outsize) |
| 7762 | { |
| 7763 | struct diff_tempfile *temp; |
| 7764 | struct child_process child = CHILD_PROCESS_INIT; |
| 7765 | struct strbuf buf = STRBUF_INIT; |
| 7766 | int err = 0; |
| 7767 | |
| 7768 | temp = prepare_temp_file(r, spec); |
| 7769 | strvec_push(&child.args, pgm); |
| 7770 | strvec_push(&child.args, temp->name); |
| 7771 | |
| 7772 | child.use_shell = 1; |
| 7773 | child.out = -1; |
| 7774 | if (start_command(&child)) { |
| 7775 | remove_tempfile(); |
| 7776 | return NULL; |
| 7777 | } |
| 7778 | |
| 7779 | if (strbuf_read(&buf, child.out, 0) < 0) |
| 7780 | err = error("error reading from textconv command '%s'", pgm); |
| 7781 | close(child.out); |
| 7782 | |
| 7783 | if (finish_command(&child) || err) { |
| 7784 | strbuf_release(&buf); |
| 7785 | remove_tempfile(); |
| 7786 | return NULL; |
| 7787 | } |
| 7788 | remove_tempfile(); |
| 7789 | |
| 7790 | return strbuf_detach(&buf, outsize); |
| 7791 | } |
| 7792 | |
| 7793 | size_t fill_textconv(struct repository *r, |
| 7794 | struct userdiff_driver *driver, |
no test coverage detected