builtin_test: Produce wide output to stderr

GNU systems don't allow mixing narrow and wide IO, so some of these
messages were lost since 1621fa43d8.

stderr is also the more logical place for error output to end up.

Fixes #3704.
This commit is contained in:
Fabian Homborg 2017-01-06 17:38:13 +01:00
parent fcd53af89d
commit 69005f8c60

View file

@ -810,11 +810,11 @@ int builtin_test(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
expression *expr = test_parser::parse_args(args, err, program_name); expression *expr = test_parser::parse_args(args, err, program_name);
if (!expr) { if (!expr) {
#if 0 #if 0
printf("Oops! test was given args:\n"); fwprintf(stderr, L"Oops! test was given args:\n");
for (size_t i=0; i < argc; i++) { for (size_t i=0; i < argc; i++) {
printf("\t%ls\n", args.at(i).c_str()); fwprintf(stderr, L"\t%ls\n", args.at(i).c_str());
} }
printf("and returned parse error: %ls\n", err.c_str()); fwprintf(stderr, L"and returned parse error: %ls\n", err.c_str());
#endif #endif
streams.err.append(err); streams.err.append(err);
return BUILTIN_TEST_FAIL; return BUILTIN_TEST_FAIL;
@ -823,9 +823,9 @@ int builtin_test(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
wcstring_list_t eval_errors; wcstring_list_t eval_errors;
bool result = expr->evaluate(eval_errors); bool result = expr->evaluate(eval_errors);
if (!eval_errors.empty() && !should_suppress_stderr_for_tests()) { if (!eval_errors.empty() && !should_suppress_stderr_for_tests()) {
printf("test returned eval errors:\n"); fwprintf(stderr, L"test returned eval errors:\n");
for (size_t i = 0; i < eval_errors.size(); i++) { for (size_t i = 0; i < eval_errors.size(); i++) {
printf("\t%ls\n", eval_errors.at(i).c_str()); fwprintf(stderr, L"\t%ls\n", eval_errors.at(i).c_str());
} }
} }
delete expr; delete expr;