mirror of https://github.com/acidanthera/audk.git
ShellPkg: CTRL-C stops a running script at the same time
This makes CTRL-C stop a running script after trying to stop the command. And adds comments to describe the behavior more clearly. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15008 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
806c49db05
commit
e3eb7d825a
|
@ -1840,8 +1840,19 @@ RunInternalCommand(
|
|||
// Pass thru the exitcode from the app.
|
||||
//
|
||||
if (ShellCommandGetExit()) {
|
||||
//
|
||||
// An Exit was requested ("exit" command), pass its value up.
|
||||
//
|
||||
Status = CommandReturnedStatus;
|
||||
} else if (CommandReturnedStatus != 0 && IsScriptOnlyCommand(FirstParameter)) {
|
||||
} else if (CommandReturnedStatus != SHELL_SUCCESS && IsScriptOnlyCommand(FirstParameter)) {
|
||||
//
|
||||
// Always abort when a script only command fails for any reason
|
||||
//
|
||||
Status = EFI_ABORTED;
|
||||
} else if (ShellCommandGetCurrentScriptFile() != NULL && CommandReturnedStatus == SHELL_ABORTED) {
|
||||
//
|
||||
// Abort when in a script and a command aborted
|
||||
//
|
||||
Status = EFI_ABORTED;
|
||||
}
|
||||
}
|
||||
|
@ -1853,11 +1864,17 @@ RunInternalCommand(
|
|||
//
|
||||
RestoreArgcArgv(ParamProtocol, &Argv, &Argc);
|
||||
|
||||
if (ShellCommandGetCurrentScriptFile() != NULL && !IsScriptOnlyCommand(FirstParameter)) {
|
||||
//
|
||||
// if this is NOT a scipt only command return success so the script won't quit.
|
||||
// prevent killing the script - this is the only place where we know the actual command name (after alias and variable replacement...)
|
||||
//
|
||||
//
|
||||
// If a script is running and the command is not a scipt only command, then
|
||||
// change return value to success so the script won't halt (unless aborted).
|
||||
//
|
||||
// Script only commands have to be able halt the script since the script will
|
||||
// not operate if they are failing.
|
||||
//
|
||||
if ( ShellCommandGetCurrentScriptFile() != NULL
|
||||
&& !IsScriptOnlyCommand(FirstParameter)
|
||||
&& Status != EFI_ABORTED
|
||||
) {
|
||||
Status = EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue