File src/running.c changed (mode: 100644) (index 3c84091ba..bfd4b4108) |
... |
... |
run_in_split(const FileView *view, const char cmd[]) |
1320 |
1320 |
free(escaped_cmd); |
free(escaped_cmd); |
1321 |
1321 |
} |
} |
1322 |
1322 |
|
|
1323 |
|
void |
|
|
1323 |
|
int |
1324 |
1324 |
output_to_custom_flist(FileView *view, const char cmd[], int very) |
output_to_custom_flist(FileView *view, const char cmd[], int very) |
1325 |
1325 |
{ |
{ |
1326 |
1326 |
char *title; |
char *title; |
|
... |
... |
output_to_custom_flist(FileView *view, const char cmd[], int very) |
1338 |
1338 |
if(error) |
if(error) |
1339 |
1339 |
{ |
{ |
1340 |
1340 |
show_error_msgf("Trouble running command", "Unable to run: %s", cmd); |
show_error_msgf("Trouble running command", "Unable to run: %s", cmd); |
1341 |
|
return; |
|
|
1341 |
|
return 1; |
1342 |
1342 |
} |
} |
1343 |
1343 |
|
|
1344 |
1344 |
flist_end_custom(view, very); |
flist_end_custom(view, very); |
|
1345 |
|
return 0; |
1345 |
1346 |
} |
} |
1346 |
1347 |
|
|
1347 |
1348 |
/* Implements process_cmd_output() callback that loads paths into custom |
/* Implements process_cmd_output() callback that loads paths into custom |
File src/running.h changed (mode: 100644) (index 0abd186ed..f3cf46a59) |
... |
... |
int run_with_filetype(FileView *view, const char beginning[], int background); |
74 |
74 |
int run_ext_command(const char cmd[], MacroFlags flags, int bg, int *save_msg); |
int run_ext_command(const char cmd[], MacroFlags flags, int bg, int *save_msg); |
75 |
75 |
|
|
76 |
76 |
/* Runs the cmd and parses its output as list of paths to compose custom view. |
/* Runs the cmd and parses its output as list of paths to compose custom view. |
77 |
|
* Very custom view implies unsorted list. */ |
|
78 |
|
void output_to_custom_flist(FileView *view, const char cmd[], int very); |
|
|
77 |
|
* Very custom view implies unsorted list. Returns zero on success, otherwise |
|
78 |
|
* non-zero is returned. */ |
|
79 |
|
int output_to_custom_flist(FileView *view, const char cmd[], int very); |
79 |
80 |
|
|
80 |
81 |
/* Executes external command capturing its output as list of lines. Sets *files |
/* Executes external command capturing its output as list of lines. Sets *files |
81 |
82 |
* and *nfiles. Returns zero on success, otherwise non-zero is returned. */ |
* and *nfiles. Returns zero on success, otherwise non-zero is returned. */ |
File tests/misc/flist_custom.c changed (mode: 100644) (index 72f2dfc23..44de1f1fa) |
... |
... |
TEST(custom_view_does_not_reset_local_state) |
480 |
480 |
columns_clear_column_descs(); |
columns_clear_column_descs(); |
481 |
481 |
} |
} |
482 |
482 |
|
|
483 |
|
TEST(files_with, IF(filenames_can_include_newline)) |
|
|
483 |
|
TEST(files_with_newline_in_names, IF(filenames_can_include_newline)) |
484 |
484 |
{ |
{ |
485 |
485 |
FILE *const f = fopen(SANDBOX_PATH "/list", "w"); |
FILE *const f = fopen(SANDBOX_PATH "/list", "w"); |
486 |
486 |
fprintf(f, "%s%c", SANDBOX_PATH "/a\nb", '\0'); |
fprintf(f, "%s%c", SANDBOX_PATH "/a\nb", '\0'); |
|
... |
... |
TEST(files_with, IF(filenames_can_include_newline)) |
492 |
492 |
stats_update_shell_type(cfg.shell); |
stats_update_shell_type(cfg.shell); |
493 |
493 |
|
|
494 |
494 |
create_file("a\nb"); |
create_file("a\nb"); |
495 |
|
output_to_custom_flist(&lwin, "cat list", 0); |
|
|
495 |
|
assert_non_null(get_cwd(lwin.curr_dir, sizeof(lwin.curr_dir))); |
|
496 |
|
assert_success(output_to_custom_flist(&lwin, "cat list", 0)); |
496 |
497 |
assert_success(unlink("a\nb")); |
assert_success(unlink("a\nb")); |
497 |
498 |
assert_success(unlink("list")); |
assert_success(unlink("list")); |
498 |
499 |
|
|