From 7cecfc078e49e1a8654a759481be31e335be2b09 Mon Sep 17 00:00:00 2001 From: "Martin T. H. Sandsmark" Date: Sun, 28 Aug 2016 19:29:08 +0200 Subject: [PATCH] Only send EOF to known shells The only processes that are "safe" or require us to send an EOF to terminate cleanly are shells, so verify that people didn't run with -e tmux or similar. REVIEW: 128791 BUG: 367746 (cherry picked from commit ce4ab922496cb9e133f96db78c5b67bc01429512) --- src/Session.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Session.cpp b/src/Session.cpp index ae539cdc..b8b42ab6 100644 --- a/src/Session.cpp +++ b/src/Session.cpp @@ -822,8 +822,10 @@ bool Session::closeInNormalWay() return true; } - // Check if the default shell is running, in that case try sending an EOF for a clean exit - if (!isForegroundProcessActive()) { + static QSet knownShells({"ash", "bash", "csh", "dash", "fish", "hush", "ksh", "mksh", "pdksh", "tcsh", "zsh"}); + + // If only the session's shell is running, try sending an EOF for a clean exit + if (!isForegroundProcessActive() && knownShells.contains(QFileInfo(_program).fileName())) { _shellProcess->sendEof(); if (_shellProcess->waitForFinished(1000)) {