ShellPkg/UefiShellLib.c: Execute: Return a Command status even in the old shell
This means we can use ShellExecute without thinking which shell environment is in use. However it still isn't ideal: if mEfiShellEnvironment2->Execute returns EFI_INVALID_PARAMETER, we can't tell whether Execute() received an invalid parameter (e.g. ParentImageHandle was NULL), or whether we tried to execute a command with an invalid parameter (for example CommandLine "ls -hurdygurdy"). 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@15183 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
committed by
oliviermartin
parent
708793148d
commit
3877d0f581
@ -1175,7 +1175,7 @@ ShellSetEnvironmentVariable (
|
|||||||
The CommandLine is executed from the current working directory on the current
|
The CommandLine is executed from the current working directory on the current
|
||||||
device.
|
device.
|
||||||
|
|
||||||
The EnvironmentVariables and Status parameters are ignored in a pre-UEFI Shell 2.0
|
The EnvironmentVariables pararemeter is ignored in a pre-UEFI Shell 2.0
|
||||||
environment. The values pointed to by the parameters will be unchanged by the
|
environment. The values pointed to by the parameters will be unchanged by the
|
||||||
ShellExecute() function. The Output parameter has no effect in a
|
ShellExecute() function. The Output parameter has no effect in a
|
||||||
UEFI Shell 2.0 environment.
|
UEFI Shell 2.0 environment.
|
||||||
@ -1203,6 +1203,7 @@ ShellExecute (
|
|||||||
OUT EFI_STATUS *Status OPTIONAL
|
OUT EFI_STATUS *Status OPTIONAL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
EFI_STATUS CmdStatus;
|
||||||
//
|
//
|
||||||
// Check for UEFI Shell 2.0 protocols
|
// Check for UEFI Shell 2.0 protocols
|
||||||
//
|
//
|
||||||
@ -1221,16 +1222,29 @@ ShellExecute (
|
|||||||
//
|
//
|
||||||
if (mEfiShellEnvironment2 != NULL) {
|
if (mEfiShellEnvironment2 != NULL) {
|
||||||
//
|
//
|
||||||
// Call EFI Shell version (not using EnvironmentVariables or Status parameters)
|
// Call EFI Shell version.
|
||||||
// Due to oddity in the EFI shell we want to dereference the ParentHandle here
|
// Due to oddity in the EFI shell we want to dereference the ParentHandle here
|
||||||
//
|
//
|
||||||
return (mEfiShellEnvironment2->Execute(*ParentHandle,
|
CmdStatus = (mEfiShellEnvironment2->Execute(*ParentHandle,
|
||||||
CommandLine,
|
CommandLine,
|
||||||
Output));
|
Output));
|
||||||
|
//
|
||||||
|
// No Status output parameter so just use the returned status
|
||||||
|
//
|
||||||
|
if (Status != NULL) {
|
||||||
|
*Status = CmdStatus;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// If there was an error, we can't tell if it was from the command or from
|
||||||
|
// the Execute() function, so we'll just assume the shell ran successfully
|
||||||
|
// and the error came from the command.
|
||||||
|
//
|
||||||
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (EFI_UNSUPPORTED);
|
return (EFI_UNSUPPORTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retreives the current directory path
|
Retreives the current directory path
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user