diff options
author | Cameron Youell <cameronyouell@gmail.com> | 2023-04-17 16:02:41 +1000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-04-24 09:21:51 +0200 |
commit | da305017dec62c734ae2abc50243a25e6c13874d (patch) | |
tree | d2161eb8e674193b5c104cf4f70e183c62a53cfd /Userland/Shell/Shell.cpp | |
parent | ba38984a6031aa1dd6fa6bfe931c346a8971ce92 (diff) | |
download | serenity-da305017dec62c734ae2abc50243a25e6c13874d.zip |
Shell: Use `JsonArray::append` in `save_to`
We can convert it into a failable function here easily
Diffstat (limited to 'Userland/Shell/Shell.cpp')
-rw-r--r-- | Userland/Shell/Shell.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Userland/Shell/Shell.cpp b/Userland/Shell/Shell.cpp index f5acf281be..4d27ea2775 100644 --- a/Userland/Shell/Shell.cpp +++ b/Userland/Shell/Shell.cpp @@ -2348,7 +2348,7 @@ void Shell::kill_job(Job const* job, int sig) } } -void Shell::save_to(JsonObject& object) +ErrorOr<void> Shell::save_to(JsonObject& object) { Core::Object::save_to(object); object.set("working_directory", cwd); @@ -2367,9 +2367,11 @@ void Shell::save_to(JsonObject& object) job_object.set("running_time", job_entry.value->timer().elapsed()); job_object.set("command", job_entry.value->cmd()); job_object.set("is_running_in_background", job_entry.value->is_running_in_background()); - job_objects.must_append(move(job_object)); + TRY(job_objects.append(move(job_object))); } object.set("jobs", move(job_objects)); + + return {}; } void Shell::possibly_print_error() const |