// Pass thru the exitcode from the app.\r
//\r
if (ShellCommandGetExit()) {\r
+ //\r
+ // An Exit was requested ("exit" command), pass its value up.\r
+ //\r
Status = CommandReturnedStatus;\r
- } else if (CommandReturnedStatus != 0 && IsScriptOnlyCommand(FirstParameter)) {\r
+ } else if (CommandReturnedStatus != SHELL_SUCCESS && IsScriptOnlyCommand(FirstParameter)) {\r
+ //\r
+ // Always abort when a script only command fails for any reason\r
+ //\r
+ Status = EFI_ABORTED;\r
+ } else if (ShellCommandGetCurrentScriptFile() != NULL && CommandReturnedStatus == SHELL_ABORTED) {\r
+ //\r
+ // Abort when in a script and a command aborted\r
+ //\r
Status = EFI_ABORTED;\r
}\r
}\r
//\r
RestoreArgcArgv(ParamProtocol, &Argv, &Argc);\r
\r
- if (ShellCommandGetCurrentScriptFile() != NULL && !IsScriptOnlyCommand(FirstParameter)) {\r
- //\r
- // if this is NOT a scipt only command return success so the script won't quit.\r
- // prevent killing the script - this is the only place where we know the actual command name (after alias and variable replacement...)\r
- //\r
+ //\r
+ // If a script is running and the command is not a scipt only command, then\r
+ // change return value to success so the script won't halt (unless aborted).\r
+ //\r
+ // Script only commands have to be able halt the script since the script will\r
+ // not operate if they are failing.\r
+ //\r
+ if ( ShellCommandGetCurrentScriptFile() != NULL\r
+ && !IsScriptOnlyCommand(FirstParameter)\r
+ && Status != EFI_ABORTED\r
+ ) {\r
Status = EFI_SUCCESS;\r
}\r
\r