From afa2523724c1b8435a0df1ef5acfe112ae5e6318 Mon Sep 17 00:00:00 2001 From: asynts Date: Mon, 28 Sep 2020 11:02:36 +0200 Subject: [PATCH] Shell: Don't execute scripts interactively. The following example should illustrate one issue arising from this: $ echo 'exit 1' > example.sh $ Shell example.sh Good-bye! This message is meant to be shown to an interactive user, but not in a shell script. --- Shell/Shell.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Shell/Shell.cpp b/Shell/Shell.cpp index 57a99f429a..12142cef2e 100644 --- a/Shell/Shell.cpp +++ b/Shell/Shell.cpp @@ -873,6 +873,8 @@ NonnullRefPtrVector Shell::run_commands(Vector& commands) bool Shell::run_file(const String& filename, bool explicitly_invoked) { TemporaryChange script_change { current_script, filename }; + TemporaryChange interactive_change { m_is_interactive, false }; + auto file_result = Core::File::open(filename, Core::File::ReadOnly); if (file_result.is_error()) { if (explicitly_invoked)