summaryrefslogtreecommitdiffstats
path: root/edify
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2018-01-30 23:13:23 +0100
committerandroid-build-merger <android-build-merger@google.com>2018-01-30 23:13:23 +0100
commitd5097253f66b95c7ec5c1fe61e052bc527e9ee1f (patch)
tree8413d33e74901d2960a7f5f7e6232a8791b13588 /edify
parentMerge "Add update_channel field to bootloader_message_ab." am: 63eb1a4444 am: 7441ee7aff (diff)
parentMerge "Avoid overwrite of the error message in AbortFn" am: bded087f7d (diff)
downloadandroid_bootable_recovery-d5097253f66b95c7ec5c1fe61e052bc527e9ee1f.tar
android_bootable_recovery-d5097253f66b95c7ec5c1fe61e052bc527e9ee1f.tar.gz
android_bootable_recovery-d5097253f66b95c7ec5c1fe61e052bc527e9ee1f.tar.bz2
android_bootable_recovery-d5097253f66b95c7ec5c1fe61e052bc527e9ee1f.tar.lz
android_bootable_recovery-d5097253f66b95c7ec5c1fe61e052bc527e9ee1f.tar.xz
android_bootable_recovery-d5097253f66b95c7ec5c1fe61e052bc527e9ee1f.tar.zst
android_bootable_recovery-d5097253f66b95c7ec5c1fe61e052bc527e9ee1f.zip
Diffstat (limited to 'edify')
-rw-r--r--edify/expr.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/edify/expr.cpp b/edify/expr.cpp
index 1b8623f03..6823b7339 100644
--- a/edify/expr.cpp
+++ b/edify/expr.cpp
@@ -114,9 +114,9 @@ Value* IfElseFn(const char* name, State* state, const std::vector<std::unique_pt
Value* AbortFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) {
std::string msg;
if (!argv.empty() && Evaluate(state, argv[0], &msg)) {
- state->errmsg = msg;
+ state->errmsg += msg;
} else {
- state->errmsg = "called abort()";
+ state->errmsg += "called abort()";
}
return nullptr;
}
@@ -410,12 +410,15 @@ Value* ErrorAbort(State* state, const char* format, ...) {
}
Value* ErrorAbort(State* state, CauseCode cause_code, const char* format, ...) {
- va_list ap;
- va_start(ap, format);
- android::base::StringAppendV(&state->errmsg, format, ap);
- va_end(ap);
- state->cause_code = cause_code;
- return nullptr;
+ std::string err_message;
+ va_list ap;
+ va_start(ap, format);
+ android::base::StringAppendV(&err_message, format, ap);
+ va_end(ap);
+ // Ensure that there's exactly one line break at the end of the error message.
+ state->errmsg = android::base::Trim(err_message) + "\n";
+ state->cause_code = cause_code;
+ return nullptr;
}
State::State(const std::string& script, void* cookie)