mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:58:11 +00:00
Shell: Show termination signal if job did not exit cleanly
This commit is contained in:
parent
48a1f7e55c
commit
59b46a1f51
2 changed files with 6 additions and 1 deletions
|
@ -84,6 +84,7 @@ public:
|
||||||
void disown() { m_should_be_disowned = true; }
|
void disown() { m_should_be_disowned = true; }
|
||||||
bool is_running_in_background() const { return m_running_in_background; }
|
bool is_running_in_background() const { return m_running_in_background; }
|
||||||
bool should_announce_exit() const { return m_should_announce_exit; }
|
bool should_announce_exit() const { return m_should_announce_exit; }
|
||||||
|
bool should_announce_signal() const { return m_should_announce_signal; }
|
||||||
bool is_suspended() const { return m_is_suspended; }
|
bool is_suspended() const { return m_is_suspended; }
|
||||||
void unblock() const;
|
void unblock() const;
|
||||||
|
|
||||||
|
@ -100,6 +101,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_should_announce_exit(bool value) { m_should_announce_exit = value; }
|
void set_should_announce_exit(bool value) { m_should_announce_exit = value; }
|
||||||
|
void set_should_announce_signal(bool value) { m_should_announce_signal = value; }
|
||||||
|
|
||||||
void deactivate() const { m_active = false; }
|
void deactivate() const { m_active = false; }
|
||||||
|
|
||||||
|
@ -121,6 +123,7 @@ private:
|
||||||
bool m_exited { false };
|
bool m_exited { false };
|
||||||
bool m_running_in_background { false };
|
bool m_running_in_background { false };
|
||||||
bool m_should_announce_exit { false };
|
bool m_should_announce_exit { false };
|
||||||
|
bool m_should_announce_signal { true };
|
||||||
int m_exit_code { -1 };
|
int m_exit_code { -1 };
|
||||||
int m_term_sig { -1 };
|
int m_term_sig { -1 };
|
||||||
Core::ElapsedTimer m_command_timer;
|
Core::ElapsedTimer m_command_timer;
|
||||||
|
|
|
@ -853,7 +853,9 @@ RefPtr<Job> Shell::run_command(const AST::Command& command)
|
||||||
if (!job->exited())
|
if (!job->exited())
|
||||||
return;
|
return;
|
||||||
if (job->is_running_in_background() && job->should_announce_exit())
|
if (job->is_running_in_background() && job->should_announce_exit())
|
||||||
fprintf(stderr, "Shell: Job %" PRIu64 "(%s) exited\n", job->job_id(), job->cmd().characters());
|
warnln("Shell: Job {} ({}) exited\n", job->job_id(), job->cmd().characters());
|
||||||
|
else if (job->signaled() && job->should_announce_signal())
|
||||||
|
warnln("Shell: Job {} ({}) {}\n", job->job_id(), job->cmd().characters(), strsignal(job->termination_signal()));
|
||||||
|
|
||||||
last_return_code = job->exit_code();
|
last_return_code = job->exit_code();
|
||||||
job->disown();
|
job->disown();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue