summaryrefslogtreecommitdiff
path: root/Userland/Shell/Shell.cpp
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2021-12-14 17:08:59 +0330
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-12-16 03:26:59 +0330
commit7ac8bd44f815dc7dd140b18cb6470d161c20b405 (patch)
treeda50f9c718fbb52b7eed53815345edbb1fa1e40c /Userland/Shell/Shell.cpp
parent4458cc249ec1e74e507ce9825731f9be235d8d27 (diff)
downloadserenity-7ac8bd44f815dc7dd140b18cb6470d161c20b405.zip
Shell: Set subshell flag after checking for its value in parent shell
This also reverts commit 07cc7eed295a29afef37c4bfaabaf57a3f4af0c1, as that attempted to fix the issue this caused (and succeeded...but it broke something else on linux).
Diffstat (limited to 'Userland/Shell/Shell.cpp')
-rw-r--r--Userland/Shell/Shell.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/Userland/Shell/Shell.cpp b/Userland/Shell/Shell.cpp
index ef4979a888..0b31ed99f6 100644
--- a/Userland/Shell/Shell.cpp
+++ b/Userland/Shell/Shell.cpp
@@ -568,12 +568,9 @@ int Shell::run_command(StringView cmd, Optional<SourcePosition> source_position_
}
tcgetattr(0, &termios);
- tcsetattr(0, TCSANOW, &default_termios);
(void)command->run(*this);
- tcsetattr(0, TCSANOW, &termios);
-
if (!has_error(ShellError::None)) {
possibly_print_error();
take_error();
@@ -743,7 +740,6 @@ RefPtr<Job> Shell::run_command(const AST::Command& command)
if (child == 0) {
close(sync_pipe[1]);
- m_is_subshell = true;
m_pid = getpid();
Core::EventLoop::notify_forked(Core::EventLoop::ForkEvent::Child);
TemporaryChange signal_handler_install { m_should_reinstall_signal_handlers, true };
@@ -769,6 +765,8 @@ RefPtr<Job> Shell::run_command(const AST::Command& command)
if (!m_is_subshell && command.should_wait)
tcsetattr(0, TCSANOW, &default_termios);
+ m_is_subshell = true;
+
if (command.should_immediately_execute_next) {
VERIFY(command.argv.is_empty());