| 935 | |
| 936 | |
| 937 | int async_query_available_blobs(const char *cmd, struct string_list *available_paths) |
| 938 | { |
| 939 | int err; |
| 940 | char *line; |
| 941 | struct cmd2process *entry; |
| 942 | struct child_process *process; |
| 943 | struct strbuf filter_status = STRBUF_INIT; |
| 944 | |
| 945 | assert(subprocess_map_initialized); |
| 946 | entry = (struct cmd2process *)subprocess_find_entry(&subprocess_map, cmd); |
| 947 | if (!entry) { |
| 948 | error(_("external filter '%s' is not available anymore although " |
| 949 | "not all paths have been filtered"), cmd); |
| 950 | return 0; |
| 951 | } |
| 952 | process = &entry->subprocess.process; |
| 953 | sigchain_push(SIGPIPE, SIG_IGN); |
| 954 | |
| 955 | err = packet_write_fmt_gently( |
| 956 | process->in, "command=list_available_blobs\n"); |
| 957 | if (err) |
| 958 | goto done; |
| 959 | |
| 960 | err = packet_flush_gently(process->in); |
| 961 | if (err) |
| 962 | goto done; |
| 963 | |
| 964 | while ((line = packet_read_line(process->out, NULL))) { |
| 965 | const char *path; |
| 966 | if (skip_prefix(line, "pathname=", &path)) |
| 967 | string_list_insert(available_paths, path); |
| 968 | else |
| 969 | ; /* ignore unknown keys */ |
| 970 | } |
| 971 | |
| 972 | err = subprocess_read_status(process->out, &filter_status); |
| 973 | if (err) |
| 974 | goto done; |
| 975 | |
| 976 | err = strcmp(filter_status.buf, "success"); |
| 977 | |
| 978 | done: |
| 979 | sigchain_pop(SIGPIPE); |
| 980 | |
| 981 | if (err) |
| 982 | handle_filter_error(&filter_status, entry, 0); |
| 983 | strbuf_release(&filter_status); |
| 984 | return !err; |
| 985 | } |
| 986 | |
| 987 | static struct convert_driver { |
| 988 | const char *name; |
no test coverage detected