mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 19:35:09 +00:00
parent
6751d03ea7
commit
6dfd503518
3 changed files with 7 additions and 17 deletions
|
@ -516,9 +516,6 @@ void Shell::restore_stdin()
|
||||||
|
|
||||||
void Shell::block_on_job(RefPtr<Job> job)
|
void Shell::block_on_job(RefPtr<Job> job)
|
||||||
{
|
{
|
||||||
ScopedValueRollback accepting_signal_rollback(m_is_accepting_signals);
|
|
||||||
m_is_accepting_signals = false;
|
|
||||||
|
|
||||||
if (!job)
|
if (!job)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -72,8 +72,6 @@ public:
|
||||||
constexpr static auto local_init_file_path = "~/.shellrc";
|
constexpr static auto local_init_file_path = "~/.shellrc";
|
||||||
constexpr static auto global_init_file_path = "/etc/shellrc";
|
constexpr static auto global_init_file_path = "/etc/shellrc";
|
||||||
|
|
||||||
bool is_accepting_signals() const { return m_is_accepting_signals; }
|
|
||||||
|
|
||||||
int run_command(const StringView&);
|
int run_command(const StringView&);
|
||||||
RefPtr<Job> run_command(AST::Command&);
|
RefPtr<Job> run_command(AST::Command&);
|
||||||
bool run_file(const String&, bool explicitly_invoked = true);
|
bool run_file(const String&, bool explicitly_invoked = true);
|
||||||
|
@ -183,7 +181,6 @@ private:
|
||||||
|
|
||||||
StringBuilder m_complete_line_builder;
|
StringBuilder m_complete_line_builder;
|
||||||
bool m_should_ignore_jobs_on_next_exit { false };
|
bool m_should_ignore_jobs_on_next_exit { false };
|
||||||
bool m_is_accepting_signals { true };
|
|
||||||
pid_t m_pid { 0 };
|
pid_t m_pid { 0 };
|
||||||
|
|
||||||
HashMap<String, RefPtr<AST::Value>> m_local_variables;
|
HashMap<String, RefPtr<AST::Value>> m_local_variables;
|
||||||
|
|
|
@ -60,26 +60,22 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
Core::EventLoop loop;
|
Core::EventLoop loop;
|
||||||
|
|
||||||
signal(SIGINT, [](int) {
|
Core::EventLoop::register_signal(SIGINT, [](int) {
|
||||||
if (!s_shell->is_accepting_signals())
|
|
||||||
return;
|
|
||||||
editor->interrupted();
|
editor->interrupted();
|
||||||
});
|
});
|
||||||
|
|
||||||
signal(SIGWINCH, [](int) {
|
Core::EventLoop::register_signal(SIGWINCH, [](int) {
|
||||||
editor->resized();
|
editor->resized();
|
||||||
});
|
});
|
||||||
|
|
||||||
signal(SIGTTIN, [](int) {});
|
Core::EventLoop::register_signal(SIGTTIN, [](int) {});
|
||||||
signal(SIGTTOU, [](int) {});
|
Core::EventLoop::register_signal(SIGTTOU, [](int) {});
|
||||||
|
|
||||||
signal(SIGHUP, [](int) {
|
Core::EventLoop::register_signal(SIGHUP, [](int) {
|
||||||
if (!s_shell->is_accepting_signals())
|
|
||||||
return;
|
|
||||||
s_shell->save_history();
|
s_shell->save_history();
|
||||||
});
|
});
|
||||||
|
|
||||||
signal(SIGCHLD, [](int) {
|
Core::EventLoop::register_signal(SIGCHLD, [](int) {
|
||||||
auto& jobs = s_shell->jobs;
|
auto& jobs = s_shell->jobs;
|
||||||
Vector<u64> disowned_jobs;
|
Vector<u64> disowned_jobs;
|
||||||
for (auto& job : jobs) {
|
for (auto& job : jobs) {
|
||||||
|
@ -116,7 +112,7 @@ int main(int argc, char** argv)
|
||||||
});
|
});
|
||||||
|
|
||||||
// Ignore SIGTSTP as the shell should not be suspended with ^Z.
|
// Ignore SIGTSTP as the shell should not be suspended with ^Z.
|
||||||
signal(SIGTSTP, [](auto) {});
|
Core::EventLoop::register_signal(SIGTSTP, [](auto) {});
|
||||||
|
|
||||||
#ifndef __serenity__
|
#ifndef __serenity__
|
||||||
sigset_t blocked;
|
sigset_t blocked;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue