ShellPkg/Shell: Fix reporting of exit status in ShellProtocol.Execute

When the exit status of the command run by the shell is other than
SHELL_SUCCESS, the shell image will now exit with EFI_ABORTED, placing the
commands exit status (which is a SHELL_STATUS) in ExitData.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brendan Jackman <Brendan.Jackman@arm.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15180 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Brendan Jackman
2014-01-24 22:27:11 +00:00
committed by oliviermartin
parent fed3be946c
commit 5223c12135
4 changed files with 236 additions and 64 deletions

View File

@@ -230,14 +230,17 @@ ProcessCommandLine(
@param[in] ImagePath The path to the image for shell. The first place to look for the startup script.
@param[in] FilePath The path to the file for shell. The second place to look for the startup script.
@param[out] ExitStatus The exit code of the script. Ignored if NULL.
Invalid when this function returns an error.
@retval EFI_SUCCESS The variable is initialized.
**/
EFI_STATUS
EFIAPI
DoStartupScript(
IN EFI_DEVICE_PATH_PROTOCOL *ImagePath,
IN EFI_DEVICE_PATH_PROTOCOL *FilePath
IN EFI_DEVICE_PATH_PROTOCOL *ImagePath,
IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
OUT SHELL_STATUS *ExitStatus
);
/**
@@ -282,7 +285,8 @@ AddLineToCommandHistory(
This will determine if the command line represents an internal shell command or dispatch an external application.
@param[in] CmdLine the command line to parse
@param[in] CmdLine the command line to parse
@param[out] ExitStatus The exit status of the command. Ignored if NULL.
@retval EFI_SUCCESS the command was completed
@retval EFI_ABORTED the command's operation was aborted
@@ -290,7 +294,8 @@ AddLineToCommandHistory(
EFI_STATUS
EFIAPI
RunCommand(
IN CONST CHAR16 *CmdLine
IN CONST CHAR16 *CmdLine,
OUT SHELL_STATUS *ExitStatus
);
/**
@@ -314,13 +319,17 @@ IsValidCommandName(
@param[in] Handle The handle to the already opened file.
@param[in] Name The name of the script file.
@param[out] ExitStatus The exit code of the script. Ignored if NULL.
Invalid when this function returns an error.
@retval EFI_SUCCESS the script completed sucessfully
**/
EFI_STATUS
EFIAPI
RunScriptFileHandle (
IN SHELL_FILE_HANDLE Handle,
IN CONST CHAR16 *Name
IN SHELL_FILE_HANDLE Handle,
IN CONST CHAR16 *Name,
OUT SHELL_STATUS *ExitStatus
);
/**
@@ -331,17 +340,20 @@ RunScriptFileHandle (
@param[in] CmdLine the command line to run.
@param[in] ParamProtocol the shell parameters protocol pointer
@param[out] ExitStatus The exit code of the script. Ignored if NULL.
Invalid when this function returns an error.
@retval EFI_SUCCESS the script completed sucessfully
**/
EFI_STATUS
EFIAPI
RunScriptFile (
IN CONST CHAR16 *ScriptPath,
IN SHELL_FILE_HANDLE Handle OPTIONAL,
IN CONST CHAR16 *CmdLine,
IN EFI_SHELL_PARAMETERS_PROTOCOL *ParamProtocol
IN CONST CHAR16 *ScriptPath,
IN SHELL_FILE_HANDLE Handle OPTIONAL,
IN CONST CHAR16 *CmdLine,
IN EFI_SHELL_PARAMETERS_PROTOCOL *ParamProtocol,
OUT SHELL_STATUS *ExitStatus
);
#endif //_SHELL_INTERNAL_HEADER_