mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Merge TFS 2064268: ConstrainedLanguage PowerShell should not block nested cmdlet invocation via runspace (#2159)
* Merge TFS 2064268: Under UMCI PowerShell should not block nested cmdlet invocation via runspace * Update SessionState.cs Fixed ExecutionContext property name error.
This commit is contained in:
committed by
Dongbo Wang
parent
1d1c8b770a
commit
fe1f035d44
@@ -93,8 +93,6 @@ namespace System.Management.Automation
|
||||
}
|
||||
|
||||
InitialSessionState.SetSessionStateDrive(Context, true);
|
||||
|
||||
InitialSessionState.CreateQuestionVariable(Context);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -351,6 +351,10 @@ namespace System.Management.Automation
|
||||
v = new PSUICultureVariable();
|
||||
this.GlobalScope.SetVariable(v.Name, v, false, true, this, CommandOrigin.Internal, fastPath: true);
|
||||
|
||||
// $?
|
||||
v = new QuestionMarkVariable(this.ExecutionContext);
|
||||
this.GlobalScope.SetVariableForce(v, this);
|
||||
|
||||
// $ShellId - if there is no runspace config, use the default string
|
||||
string shellId = ExecutionContext.ShellID;
|
||||
|
||||
@@ -648,4 +652,4 @@ namespace System.Management.Automation
|
||||
}
|
||||
#endregion Errors
|
||||
} // SessionStateInternal class
|
||||
}
|
||||
}
|
||||
|
||||
@@ -629,6 +629,24 @@ namespace System.Management.Automation
|
||||
return variable;
|
||||
} // SetVariable
|
||||
|
||||
/// <summary>
|
||||
/// Sets a variable to scope without any checks.
|
||||
/// This is intended to be used only for global scope.
|
||||
/// </summary>
|
||||
/// <param name="variableToSet">PSVariable to set</param>
|
||||
/// <param name="sessionState">SessionState for variable</param>
|
||||
/// <returns></returns>
|
||||
internal void SetVariableForce(PSVariable variableToSet, SessionStateInternal sessionState)
|
||||
{
|
||||
if (Parent != null)
|
||||
{
|
||||
throw new NotImplementedException("SetVariableForce");
|
||||
}
|
||||
|
||||
variableToSet.SessionState = sessionState;
|
||||
GetPrivateVariables()[variableToSet.Name] = variableToSet;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets a variable to the given value.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user