diff options
author | Jaben Carsey <jaben.carsey@intel.com> | 2016-05-10 13:35:14 -0700 |
---|---|---|
committer | Jaben Carsey <jaben.carsey@intel.com> | 2016-05-12 08:15:00 -0700 |
commit | 063aa89bef89e035fc0ed285ace8f2fff106d37a (patch) | |
tree | e5af4089fda1fdf1aa2ae0c98162770e3d6bb454 /ShellPkg/Application | |
parent | c976f9cb7dbd0258697fb2dcd2e1a423ca2b94e0 (diff) | |
download | edk2-063aa89bef89e035fc0ed285ace8f2fff106d37a.zip edk2-063aa89bef89e035fc0ed285ace8f2fff106d37a.tar.gz edk2-063aa89bef89e035fc0ed285ace8f2fff106d37a.tar.bz2 |
report line number for command errors in a script.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Qiu Shumin <shumin.qiu@intel.com>
Diffstat (limited to 'ShellPkg/Application')
-rw-r--r-- | ShellPkg/Application/Shell/Shell.c | 6 | ||||
-rw-r--r-- | ShellPkg/Application/Shell/Shell.uni | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c index 12daff9..b06c1ef 100644 --- a/ShellPkg/Application/Shell/Shell.c +++ b/ShellPkg/Application/Shell/Shell.c @@ -2518,7 +2518,11 @@ SetupAndRunCommandOrFile( // Now print errors
//
if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_ERROR), ShellInfoObject.HiiHandle, (VOID*)(Status));
+ if (ShellCommandGetCurrentScriptFile() == NULL || ShellCommandGetCurrentScriptFile()->CurrentCommand == NULL) {
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_ERROR), ShellInfoObject.HiiHandle, (VOID*)(Status));
+ } else {
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_ERROR_SCRIPT), ShellInfoObject.HiiHandle, (VOID*)(Status), ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);
+ }
}
//
diff --git a/ShellPkg/Application/Shell/Shell.uni b/ShellPkg/Application/Shell/Shell.uni index 3947d01..ef69f89 100644 --- a/ShellPkg/Application/Shell/Shell.uni +++ b/ShellPkg/Application/Shell/Shell.uni @@ -40,6 +40,7 @@ #string STR_SHELL_CRLF #language en-US "\r\n"
#string STR_SHELL_ERROR #language en-US "%NCommand Error Status: %r\r\n"
+#string STR_SHELL_ERROR_SCRIPT #language en-US "%NScript Error Status: %r (line number %d)\r\n"
#string STR_SHELL_INVALID_MAPPING #language en-US "%N'%B%s%N' is not a valid mapping.\r\n"
#string STR_SHELL_INVALID_SPLIT #language en-US "Invalid use of pipe (%B|%N).\r\n"
|