mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:18:11 +00:00
Shell: Provide some information to inspectors
This commit is contained in:
parent
e75f7ddb1b
commit
d582c03233
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();
|
Shell();
|
||||||
virtual ~Shell() override;
|
virtual ~Shell() override;
|
||||||
|
|
||||||
|
// ^Core::Object
|
||||||
|
virtual void save_to(JsonObject&) override;
|
||||||
|
|
||||||
struct SpawnedProcess {
|
struct SpawnedProcess {
|
||||||
String name;
|
String name;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue