mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:27:35 +00:00
Shell: Do not reset the terminal attributes when command is run in bg
Also removes a FIXME that no longer applies.
This commit is contained in:
parent
c296bcc1d9
commit
927e2fc6bc
2 changed files with 8 additions and 8 deletions
|
@ -348,10 +348,6 @@ void Background::dump(int level) const
|
||||||
|
|
||||||
RefPtr<Value> Background::run(RefPtr<Shell> shell)
|
RefPtr<Value> Background::run(RefPtr<Shell> shell)
|
||||||
{
|
{
|
||||||
// FIXME: Currently this does not work correctly if `m_command.would_execute()',
|
|
||||||
// as it runs the node, which means nodes likes And and Or will evaluate
|
|
||||||
// all but their last subnode before yielding to this, causing a command
|
|
||||||
// like `foo && bar&` to effectively be `foo && (bar&)`.
|
|
||||||
auto commands = m_command->to_lazy_evaluated_commands(shell);
|
auto commands = m_command->to_lazy_evaluated_commands(shell);
|
||||||
for (auto& command : commands)
|
for (auto& command : commands)
|
||||||
command.should_wait = false;
|
command.should_wait = false;
|
||||||
|
|
|
@ -541,16 +541,13 @@ RefPtr<Job> Shell::run_command(const AST::Command& command)
|
||||||
if (child == 0) {
|
if (child == 0) {
|
||||||
close(sync_pipe[1]);
|
close(sync_pipe[1]);
|
||||||
|
|
||||||
if (!m_is_subshell)
|
|
||||||
tcsetattr(0, TCSANOW, &default_termios);
|
|
||||||
|
|
||||||
m_is_subshell = true;
|
m_is_subshell = true;
|
||||||
m_pid = getpid();
|
m_pid = getpid();
|
||||||
Core::EventLoop::notify_forked(Core::EventLoop::ForkEvent::Child);
|
Core::EventLoop::notify_forked(Core::EventLoop::ForkEvent::Child);
|
||||||
jobs.clear();
|
jobs.clear();
|
||||||
|
|
||||||
if (apply_rewirings() == IterationDecision::Break)
|
if (apply_rewirings() == IterationDecision::Break)
|
||||||
return nullptr;
|
_exit(126);
|
||||||
|
|
||||||
fds.collect();
|
fds.collect();
|
||||||
|
|
||||||
|
@ -564,8 +561,15 @@ RefPtr<Job> Shell::run_command(const AST::Command& command)
|
||||||
dbg() << "Oof";
|
dbg() << "Oof";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SH_DEBUG
|
||||||
|
dbg() << "Synced up with parent, we're good to exec()";
|
||||||
|
#endif
|
||||||
|
|
||||||
close(sync_pipe[0]);
|
close(sync_pipe[0]);
|
||||||
|
|
||||||
|
if (!m_is_subshell && command.should_wait)
|
||||||
|
tcsetattr(0, TCSANOW, &default_termios);
|
||||||
|
|
||||||
if (command.should_immediately_execute_next) {
|
if (command.should_immediately_execute_next) {
|
||||||
ASSERT(command.argv.is_empty());
|
ASSERT(command.argv.is_empty());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue