fixes for IPF, CTRL-C support, and file redirection.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11066 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jcarsey
2010-11-16 22:31:47 +00:00
parent 3a4932d079
commit 8be0ba36fc
12 changed files with 911 additions and 96 deletions

View File

@ -52,6 +52,10 @@ SHELL_INFO ShellInfoObject = {
NULL,
{0,0,NULL,NULL},
{0,0},
NULL,
NULL,
NULL,
NULL
};
STATIC CONST CHAR16 mScriptExtension[] = L".NSH";
@ -271,9 +275,7 @@ UefiMain (
//
// Set up the event for CTRL-C monitoring...
//
///@todo add support for using SimpleInputEx here
// if SimpleInputEx is not available display a warning.
Status = InernalEfiShellStartMonitor();
}
if (!EFI_ERROR(Status) && PcdGet8(PcdShellSupportLevel) >= 1) {
@ -303,6 +305,11 @@ UefiMain (
ShellInfoObject.ConsoleInfo->Enabled = TRUE;
ShellInfoObject.ConsoleInfo->RowCounter = 0;
//
// Reset the CTRL-C event (yes we ignore the return values)
//
Status = gBS->CheckEvent (ShellInfoObject.NewEfiShellProtocol->ExecutionBreak);
//
// Display Prompt
//
@ -319,11 +326,6 @@ UefiMain (
gBS->CloseEvent(ShellInfoObject.UserBreakTimer);
DEBUG_CODE(ShellInfoObject.UserBreakTimer = NULL;);
}
if (ShellInfoObject.NewEfiShellProtocol->IsRootShell()){
ShellInfoObject.NewEfiShellProtocol->SetEnv(L"cwd", L"", TRUE);
}
if (ShellInfoObject.ImageDevPath != NULL) {
FreePool(ShellInfoObject.ImageDevPath);
DEBUG_CODE(ShellInfoObject.ImageDevPath = NULL;);
@ -337,6 +339,9 @@ UefiMain (
DEBUG_CODE(ShellInfoObject.NewShellParametersProtocol = NULL;);
}
if (ShellInfoObject.NewEfiShellProtocol != NULL){
if (ShellInfoObject.NewEfiShellProtocol->IsRootShell()){
ShellInfoObject.NewEfiShellProtocol->SetEnv(L"cwd", L"", TRUE);
}
CleanUpShellProtocol(ShellInfoObject.NewEfiShellProtocol);
DEBUG_CODE(ShellInfoObject.NewEfiShellProtocol = NULL;);
}
@ -1186,6 +1191,7 @@ RunCommand(
SHELL_FILE_HANDLE OriginalStdIn;
SHELL_FILE_HANDLE OriginalStdOut;
SHELL_FILE_HANDLE OriginalStdErr;
SYSTEM_TABLE_INFO OriginalSystemTableInfo;
CHAR16 *TempLocation3;
UINTN Count;
UINTN Count2;
@ -1311,7 +1317,7 @@ RunCommand(
Status = UpdateStdInStdOutStdErr(ShellInfoObject.NewShellParametersProtocol, PostVariableCmdLine, &OriginalStdIn, &OriginalStdOut, &OriginalStdErr);
Status = UpdateStdInStdOutStdErr(ShellInfoObject.NewShellParametersProtocol, PostVariableCmdLine, &OriginalStdIn, &OriginalStdOut, &OriginalStdErr, &OriginalSystemTableInfo);
if (EFI_ERROR(Status)) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_INVALID_REDIR), ShellInfoObject.HiiHandle);
} else {
@ -1430,7 +1436,7 @@ RunCommand(
RestoreArgcArgv(ShellInfoObject.NewShellParametersProtocol, &Argv, &Argc);
RestoreStdInStdOutStdErr(ShellInfoObject.NewShellParametersProtocol, &OriginalStdIn, &OriginalStdOut, &OriginalStdErr);
RestoreStdInStdOutStdErr(ShellInfoObject.NewShellParametersProtocol, &OriginalStdIn, &OriginalStdOut, &OriginalStdErr, &OriginalSystemTableInfo);
}
if (CommandName != NULL) {
if (ShellCommandGetCurrentScriptFile() != NULL && !IsScriptOnlyCommand(CommandName)) {