diff options
author | Jaben Carsey <jaben.carsey@intel.com> | 2013-12-19 21:55:13 +0000 |
---|---|---|
committer | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2013-12-19 21:55:13 +0000 |
commit | e3eb7d825adae351f1a45e7809c8506b364ee059 (patch) | |
tree | ff669c9ac3c5f7bfef70590a3eba96e204172ef4 /ShellPkg/Application | |
parent | 806c49db0538080ac397892c750b86d1c55d32af (diff) | |
download | edk2-platforms-e3eb7d825adae351f1a45e7809c8506b364ee059.tar.xz |
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
Diffstat (limited to 'ShellPkg/Application')
-rw-r--r-- | ShellPkg/Application/Shell/Shell.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c index fe722e9554..5e3af1d056 100644 --- a/ShellPkg/Application/Shell/Shell.c +++ b/ShellPkg/Application/Shell/Shell.c @@ -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;
}
|