When execute a command with tailing blank spaces in ShellProtocol.Execute() 
Shell will fail. This patch move the TrimSpaces operation into 
ParseCommandLineToArgs function to fix the problem.

Cc: Ruiyu Ni <[email protected]>
Cc: Jaben Carsey <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yang Jadis <[email protected]>
Signed-off-by: Qiu Shumin <[email protected]>
---
 ShellPkg/Application/Shell/ShellParametersProtocol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ShellPkg/Application/Shell/ShellParametersProtocol.c 
b/ShellPkg/Application/Shell/ShellParametersProtocol.c
index bc19df7..b404987 100644
--- a/ShellPkg/Application/Shell/ShellParametersProtocol.c
+++ b/ShellPkg/Application/Shell/ShellParametersProtocol.c
@@ -206,6 +206,7 @@ ParseCommandLineToArgs(
     return (EFI_SUCCESS);
   }
 
+  TrimSpaces(&(CHAR16*)CommandLine);
   Size = StrSize(CommandLine);
   TempParameter = AllocateZeroPool(Size);
   if (TempParameter == NULL) {
@@ -359,7 +360,6 @@ CreatePopulateInstallShellParametersProtocol (
     //
     // Populate Argc and Argv
     //
-    TrimSpaces (&FullCommandLine);
     Status = ParseCommandLineToArgs(FullCommandLine,
                                     &(*NewShellParameters)->Argv,
                                     &(*NewShellParameters)->Argc);
-- 
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to