internal override void Execute(ExecutionContext context, ICommandRuntime commandRuntime)
{
ExecutionContext nestedContext = context.CreateNestedContext();
if (lValue is VariableNode)
{
VariableNode varNode = (VariableNode)lValue;
if (! (context.CurrentRunspace is LocalRunspace))
throw new InvalidOperationException("Invalid context");
// MUST: fix this with the commandRuntime
Pipeline pipeline = context.CurrentRunspace.CreateNestedPipeline();
context.PushPipeline(pipeline);
try
{
Command cmd = new Command("Set-Variable");
cmd.Parameters.Add("Name", new string[] { varNode.Text });
cmd.Parameters.Add("Value", rValue.GetValue(context));
// TODO: implement command invoke
pipeline.Commands.Add(cmd);
pipeline.Invoke();
}
catch (Exception)
{
throw;
}
finally
{
context.PopPipeline();
}
}
}