private PipelineProcessor BuildRedirectionPipeline( string path, ExecutionContext context) { CommandProcessorBase command = context.CreateCommand("out-file"); command.AddParameter("-encoding", (object)"unicode"); if (this.Appending) { command.AddParameter("-append", (object)true); } command.AddParameter("-filepath", (object)path); PipelineProcessor pipelineProcessor = new PipelineProcessor(); pipelineProcessor.Add(command); try { pipelineProcessor.StartStepping(true); } catch (RuntimeException ex) { if (ex.ErrorRecord.Exception is ArgumentException) { throw InterpreterError.NewInterpreterExceptionWithInnerException((object)null, typeof(RuntimeException), this._token, "RedirectionFailed", ex.ErrorRecord.Exception, (object)path, (object)ex.ErrorRecord.Exception.Message); } ex.ErrorRecord.SetInvocationInfo(new InvocationInfo((CommandInfo)null, this._token, context)); throw ex; } return(pipelineProcessor); }