Shell: Use JsonArray::append
in save_to
We can convert it into a failable function here easily
This commit is contained in:
parent
ba38984a60
commit
da305017de
Notes:
sideshowbarker
2024-07-16 21:05:48 +09:00
Author: https://github.com/cammo1123 Commit: https://github.com/SerenityOS/serenity/commit/da305017de Pull-request: https://github.com/SerenityOS/serenity/pull/18409 Reviewed-by: https://github.com/gmta Reviewed-by: https://github.com/krkk
2 changed files with 5 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -402,7 +402,7 @@ private:
|
|||
bool is_allowed_to_modify_termios(const AST::Command&) const;
|
||||
|
||||
// FIXME: Port to Core::Property
|
||||
void save_to(JsonObject&);
|
||||
ErrorOr<void> save_to(JsonObject&);
|
||||
void bring_cursor_to_beginning_of_a_line() const;
|
||||
|
||||
Optional<int> resolve_job_spec(StringView);
|
||||
|
|
Loading…
Add table
Reference in a new issue