mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 02:03:06 -05:00
Shell: Provide some information to inspectors
This commit is contained in:
parent
e75f7ddb1b
commit
d582c03233
Notes:
sideshowbarker
2024-07-19 06:05:24 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/d582c03233b Pull-request: https://github.com/SerenityOS/serenity/pull/2398 Reviewed-by: https://github.com/awesomekling
2 changed files with 27 additions and 0 deletions
|
@ -1835,3 +1835,27 @@ void Shell::stop_all_jobs()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Shell::save_to(JsonObject& object)
|
||||
{
|
||||
Core::Object::save_to(object);
|
||||
object.set("working_directory", cwd);
|
||||
object.set("username", username);
|
||||
object.set("user_home_path", home);
|
||||
object.set("user_id", uid);
|
||||
object.set("directory_stack_size", directory_stack.size());
|
||||
object.set("cd_history_size", cd_history.size());
|
||||
|
||||
// Jobs.
|
||||
JsonArray job_objects;
|
||||
for (auto& job_entry : jobs) {
|
||||
JsonObject job_object;
|
||||
job_object.set("pid", job_entry.value->pid());
|
||||
job_object.set("pgid", job_entry.value->pgid());
|
||||
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.append(move(job_object));
|
||||
}
|
||||
object.set("jobs", move(job_objects));
|
||||
}
|
||||
|
|
|
@ -158,6 +158,9 @@ private:
|
|||
Shell();
|
||||
virtual ~Shell() override;
|
||||
|
||||
// ^Core::Object
|
||||
virtual void save_to(JsonObject&) override;
|
||||
|
||||
struct SpawnedProcess {
|
||||
String name;
|
||||
pid_t pid;
|
||||
|
|
Loading…
Add table
Reference in a new issue