mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:47:45 +00:00
HackStudio: Add a widget showing the state of console's running process
We now have a little widget that sits above the terminal view in the build/application console. When a child process is running, we show its PID, name, scheduling counter, and amount of resident memory in a live little overview. This is not working right just yet, since we don't know how to get to the actually active PID on the TTY. Or, well, we find the active PID by looking at the PGID of our fork()ed child. This manages to find children spawned by Shell, but not children spawned by make, for instance. I need to figure out how to find those.
This commit is contained in:
parent
489e451cce
commit
272317bce2
5 changed files with 109 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
#include "TerminalWrapper.h"
|
||||
#include "ProcessStateWidget.h"
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/CConfigFile.h>
|
||||
#include <LibGUI/GBoxLayout.h>
|
||||
|
@ -44,6 +45,7 @@ void TerminalWrapper::run_command(const String& command)
|
|||
} else if (WIFSIGNALED(wstatus)) {
|
||||
m_terminal_widget->inject_string(String::format("\033[34;1m(Command signaled with %s!)\033[0m\n", strsignal(WTERMSIG(wstatus))));
|
||||
}
|
||||
m_process_state_widget->set_pid(-1);
|
||||
m_pid = -1;
|
||||
};
|
||||
|
||||
|
@ -106,6 +108,9 @@ void TerminalWrapper::run_command(const String& command)
|
|||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
// Parent process, cont'd.
|
||||
m_process_state_widget->set_pid(m_pid);
|
||||
}
|
||||
|
||||
TerminalWrapper::TerminalWrapper(GWidget* parent)
|
||||
|
@ -113,6 +118,8 @@ TerminalWrapper::TerminalWrapper(GWidget* parent)
|
|||
{
|
||||
set_layout(make<GBoxLayout>(Orientation::Vertical));
|
||||
|
||||
m_process_state_widget = ProcessStateWidget::construct(this);
|
||||
|
||||
RefPtr<CConfigFile> config = CConfigFile::get_for_app("Terminal");
|
||||
m_terminal_widget = TerminalWidget::construct(-1, false, config);
|
||||
add_child(*m_terminal_widget);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue