public HttpOutputPipelineStage(string[] commandLine)
            : base(commandLine)
        {
            Init.InitIfNotAlreadyDone();
            int port = nextPort++;
            this.processLock = new object();
            this.exe = commandLine[0];
            this.commandLineParameters = new List<string>(commandLine.Skip(1));
            this.commandLineParameters.Add("$PowerArgs.ArgPipelineInputPort:" + port);
            Sender = new HttpPipelineMessageSender(port);

            lock (processLock)
            {
                if (externalProcess == null)
                {
                    externalProcess = new Process();
                    externalProcess.StartInfo = new ProcessStartInfo(exe, string.Join(" ", commandLineParameters.Select(p => '"' + p + '"')));
                    externalProcess.StartInfo.UseShellExecute = false;
                    externalProcess.StartInfo.CreateNoWindow = true;

                    try
                    {
                        externalProcess.Start();
                    }
                    catch(Exception ex)
                    {
                        throw new ArgException("Failed to start external process: " + exe, ex);
                    }
                }
            }
        }
        public HttpOutputPipelineStage(string[] commandLine)
            : base(commandLine)
        {
            Init.InitIfNotAlreadyDone();
            int port = nextPort++;

            this.processLock           = new object();
            this.exe                   = commandLine[0];
            this.commandLineParameters = new List <string>(commandLine.Skip(1));
            this.commandLineParameters.Add("$PowerArgs.ArgPipelineInputPort:" + port);
            Sender = new HttpPipelineMessageSender(port);

            lock (processLock)
            {
                if (externalProcess == null)
                {
                    externalProcess           = new Process();
                    externalProcess.StartInfo = new ProcessStartInfo(exe, string.Join(" ", commandLineParameters.Select(p => '"' + p + '"')));
                    externalProcess.StartInfo.UseShellExecute = false;
                    externalProcess.StartInfo.CreateNoWindow  = true;

                    try
                    {
                        externalProcess.Start();
                    }
                    catch (Exception ex)
                    {
                        throw new ArgException("Failed to start external process: " + exe, ex);
                    }
                }
            }
        }