int capture_output_to_menu(FileView *view, const char cmd[], int user_sh, menu_state_t *m) { if(process_cmd_output("Loading menu", cmd, user_sh, 0, &output_handler, m->d) != 0) { show_error_msgf("Trouble running command", "Unable to run: %s", cmd); return 0; } if(ui_cancellation_requested()) { append_to_string(&m->d->title, "(cancelled)"); append_to_string(&m->d->empty_msg, " (cancelled)"); } return display_menu(m, view); }
void output_to_custom_flist(FileView *view, const char cmd[], int very) { char *title; int error; title = format_str("!%s", cmd); flist_custom_start(view, title); free(title); setup_shellout_env(); error = (process_cmd_output("Loading custom view", cmd, 1, &path_handler, view) != 0); cleanup_shellout_env(); if(error) { show_error_msgf("Trouble running command", "Unable to run: %s", cmd); return; } flist_end_custom(view, very); }