mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 23:24:39 +00:00
Improved error reporting for builtin_test
This commit is contained in:
parent
ed7c10f366
commit
6788c2710f
3 changed files with 10 additions and 0 deletions
|
@ -129,6 +129,10 @@ const wcstring &get_stderr_buffer() {
|
|||
return stderr_buffer;
|
||||
}
|
||||
|
||||
void builtin_show_error(const wcstring &err) {
|
||||
ASSERT_IS_MAIN_THREAD();
|
||||
stderr_buffer.append(err);
|
||||
}
|
||||
|
||||
/**
|
||||
Stack containing builtin I/O for recursive builtin calls.
|
||||
|
|
|
@ -94,6 +94,9 @@ enum
|
|||
const wcstring &get_stdout_buffer();
|
||||
const wcstring &get_stderr_buffer();
|
||||
|
||||
/** Output an error */
|
||||
void builtin_show_error(const wcstring &err);
|
||||
|
||||
/**
|
||||
Kludge. Tells builtins if output is to screen
|
||||
*/
|
||||
|
|
|
@ -595,11 +595,14 @@ int builtin_test( parser_t &parser, wchar_t **argv )
|
|||
wcstring err;
|
||||
expression *expr = test_parser::parse_args(args, err);
|
||||
if (! expr) {
|
||||
#if 0
|
||||
printf("Oops! test was given args:\n");
|
||||
for (size_t i=0; i < argc; i++) {
|
||||
printf("\t%ls\n", args.at(i).c_str());
|
||||
}
|
||||
printf("and returned parse error: %ls\n", err.c_str());
|
||||
#endif
|
||||
builtin_show_error(err);
|
||||
return BUILTIN_TEST_FAIL;
|
||||
} else {
|
||||
wcstring_list_t eval_errors;
|
||||
|
|
Loading…
Reference in a new issue