From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id AB2D221A1097C for ; Tue, 28 Nov 2017 01:02:42 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Nov 2017 01:07:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,467,1505804400"; d="scan'208";a="7923163" Received: from unknown (HELO ray-dev.ccr.corp.intel.com) ([10.239.9.37]) by fmsmga001.fm.intel.com with ESMTP; 28 Nov 2017 01:07:03 -0800 From: Ruiyu Ni To: edk2-devel@lists.01.org Cc: Jaben Carsey Date: Tue, 28 Nov 2017 17:07:02 +0800 Message-Id: <20171128090702.63424-1-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.15.0.gvfs.1.preview.4 Subject: [PATCH] ShellPkg: Fix the bug that handling Ctrl-C improperly X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 09:02:42 -0000 Current implementation resets the CTRL-C event early when printing the shell prompt, when user types "ls", "ls" command is terminated immediately when starts. It's not an expected behavior from users' perspective. Correct way is to reset the CTRL-C event just before running the command, which is a bit later than current point. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Cc: Jaben Carsey --- ShellPkg/Application/Shell/Shell.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c index 2adc99240c..577e17311b 100644 --- a/ShellPkg/Application/Shell/Shell.c +++ b/ShellPkg/Application/Shell/Shell.c @@ -620,11 +620,6 @@ UefiMain ( ShellInfoObject.ConsoleInfo->Enabled = TRUE; ShellInfoObject.ConsoleInfo->RowCounter = 0; - // - // Reset the CTRL-C event (yes we ignore the return values) - // - Status = gBS->CheckEvent (ShellInfoObject.NewEfiShellProtocol->ExecutionBreak); - // // Display Prompt // @@ -1346,9 +1341,14 @@ DoShellPrompt ( // Null terminate the string and parse it // if (!EFI_ERROR (Status)) { + // + // Reset the CTRL-C event just before running the command (yes we ignore the return values) + // + Status = gBS->CheckEvent (ShellInfoObject.NewEfiShellProtocol->ExecutionBreak); + CmdLine[BufferSize / sizeof (CHAR16)] = CHAR_NULL; Status = RunCommand(CmdLine); - } + } // // Done with this command -- 2.15.0.gvfs.1.preview.4