diff --git a/builtin.cpp b/builtin.cpp index 872ba490a..3a61d16f2 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -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. diff --git a/builtin.h b/builtin.h index a4a34ce9d..f2093780b 100644 --- a/builtin.h +++ b/builtin.h @@ -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 */ diff --git a/builtin_test.cpp b/builtin_test.cpp index 79018fc90..220732046 100644 --- a/builtin_test.cpp +++ b/builtin_test.cpp @@ -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;