From 0d9123ec91ed572cfed76eae82c88ad1573332f5 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Mon, 26 Feb 2018 11:25:07 +0100 Subject: [PATCH] [math] Return STATUS_CMD_ERROR when an error occured --- src/builtin_math.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/builtin_math.cpp b/src/builtin_math.cpp index eb323294a..d8dbb1485 100644 --- a/src/builtin_math.cpp +++ b/src/builtin_math.cpp @@ -134,6 +134,7 @@ static int evaluate_expression(const wchar_t *cmd, parser_t &parser, io_streams_ math_cmd_opts_t &opts, wcstring &expression) { UNUSED(parser); + int retval = STATUS_CMD_OK; te_error_t error; char *narrow_str = wcs2str(expression); // Switch locale while computing stuff. @@ -155,10 +156,11 @@ static int evaluate_expression(const wchar_t *cmd, parser_t &parser, io_streams_ streams.err.append_format(L"%ls: Error: %ls\n", cmd, math_describe_error(error).c_str()); streams.err.append_format(L"'%ls'\n", expression.c_str()); streams.err.append_format(L"%*lc^\n", error.position - 1, L' '); + retval = STATUS_CMD_ERROR; } free(narrow_str); free(saved_locale); - return STATUS_CMD_OK; + return retval; } /// The math builtin evaluates math expressions.