]> git.proxmox.com Git - mirror_edk2.git/commitdiff
report line number for command errors in a script.
authorJaben Carsey <jaben.carsey@intel.com>
Tue, 10 May 2016 20:35:14 +0000 (13:35 -0700)
committerJaben Carsey <jaben.carsey@intel.com>
Thu, 12 May 2016 15:15:00 +0000 (08:15 -0700)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Qiu Shumin <shumin.qiu@intel.com>
ShellPkg/Application/Shell/Shell.c
ShellPkg/Application/Shell/Shell.uni

index 12daff91912873d57cb5d831c5eba9155303918a..b06c1efb4245a8ab32289a0cc6c231775a91f520 100644 (file)
@@ -2518,7 +2518,11 @@ SetupAndRunCommandOrFile(
   // Now print errors\r
   //\r
   if (EFI_ERROR(Status)) {\r
-    ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_ERROR), ShellInfoObject.HiiHandle, (VOID*)(Status));\r
+    if (ShellCommandGetCurrentScriptFile() == NULL || ShellCommandGetCurrentScriptFile()->CurrentCommand == NULL) {\r
+      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_ERROR), ShellInfoObject.HiiHandle, (VOID*)(Status));\r
+    } else {\r
+      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_ERROR_SCRIPT), ShellInfoObject.HiiHandle, (VOID*)(Status), ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);\r
+    }\r
   }\r
 \r
   //\r
index 3947d01b5316295a2ecf2ecb70956b4ecac7f792..ef69f891d2071f409874763b409dd8710a4c2ae6 100644 (file)
@@ -40,6 +40,7 @@
 #string STR_SHELL_CRLF                #language en-US "\r\n"\r
 \r
 #string STR_SHELL_ERROR               #language en-US  "%NCommand Error Status: %r\r\n"\r
+#string STR_SHELL_ERROR_SCRIPT        #language en-US  "%NScript Error Status: %r (line number %d)\r\n"\r
 \r
 #string STR_SHELL_INVALID_MAPPING     #language en-US "%N'%B%s%N' is not a valid mapping.\r\n"\r
 #string STR_SHELL_INVALID_SPLIT       #language en-US "Invalid use of pipe (%B|%N).\r\n"\r