public override void StartProcess(string command, string arguments, string workDir, Dictionary <string, string> envVariables)
        {
            ProcessOperation operation = CommandLog.LogProcessStart(command, arguments, workDir);

            try
            {
                var commandLine = new ArgumentBuilder {
                    command.Quote(), arguments
                }.ToString();
                var outputProcessor = new ConsoleCommandLineOutputProcessor(commandLine.Length, FireDataReceived);

                var startInfo = new ConEmuStartInfo
                {
                    ConsoleProcessCommandLine        = commandLine,
                    IsEchoingConsoleCommandLine      = true,
                    WhenConsoleProcessExits          = WhenConsoleProcessExits.KeepConsoleEmulatorAndShowMessage,
                    AnsiStreamChunkReceivedEventSink = outputProcessor.AnsiStreamChunkReceived,
                    StartupDirectory = workDir
                };

                foreach (var(name, value) in envVariables)
                {
                    startInfo.SetEnv(name, value);
                }

                startInfo.ConsoleProcessExitedEventSink = (_, args) =>
                {
                    _nLastExitCode = args.ExitCode;
                    operation.LogProcessEnd(_nLastExitCode);
                    outputProcessor.Flush();
                    FireProcessExited();
                };

                startInfo.ConsoleEmulatorClosedEventSink = (sender, _) =>
                {
                    Validates.NotNull(_terminal);
                    if (sender == _terminal.RunningSession)
                    {
                        FireTerminated();
                    }
                };

                Validates.NotNull(_terminal);
                _terminal.Start(startInfo, ThreadHelper.JoinableTaskFactory, AppSettings.ConEmuStyle.Value, AppSettings.ConEmuFontSize.Value);
            }
            catch (Exception ex)
            {
                operation.LogProcessEnd(ex);
                throw;
            }
        }
        public override void StartProcess(string command, string arguments, string workdir, Dictionary <string, string> envVariables)
        {
            var cmdl = new StringBuilder();

            if (command != null)
            {
                cmdl.Append(command.Quote() /* do the escaping for it */);
                cmdl.Append(" ");
            }

            cmdl.Append(arguments /* expecting to be already escaped */);

            var startinfo = new ConEmuStartInfo();

            startinfo.ConsoleProcessCommandLine = cmdl.ToString();
            if (AppSettings.ConEmuStyle.ValueOrDefault != "Default")
            {
                startinfo.ConsoleProcessExtraArgs = " -new_console:P:\"" + AppSettings.ConEmuStyle.ValueOrDefault + "\"";
            }

            startinfo.StartupDirectory = workdir;

            foreach (var(name, value) in envVariables)
            {
                startinfo.SetEnv(name, value);
            }

            startinfo.WhenConsoleProcessExits = WhenConsoleProcessExits.KeepConsoleEmulatorAndShowMessage;
            var outputProcessor = new ConsoleCommandLineOutputProcessor(startinfo.ConsoleProcessCommandLine.Length, FireDataReceived);

            startinfo.AnsiStreamChunkReceivedEventSink = outputProcessor.AnsiStreamChunkReceived;

            startinfo.ConsoleProcessExitedEventSink = (sender, args) =>
            {
                outputProcessor.Flush();
                _nLastExitCode = args.ExitCode;
                FireProcessExited();
            };

            startinfo.ConsoleEmulatorClosedEventSink = (s, e) =>
            {
                if (s == _terminal.RunningSession)
                {
                    FireTerminated();
                }
            };
            startinfo.IsEchoingConsoleCommandLine = true;

            _terminal.Start(startinfo);
        }
        public override void StartProcess(string command, string arguments, string workDir, Dictionary <string, string> envVariables)
        {
            var commandLine = new ArgumentBuilder {
                command.Quote(), arguments
            }.ToString();
            var outputProcessor = new ConsoleCommandLineOutputProcessor(commandLine.Length, FireDataReceived);

            var startInfo = new ConEmuStartInfo
            {
                ConsoleProcessCommandLine        = commandLine,
                IsEchoingConsoleCommandLine      = true,
                WhenConsoleProcessExits          = WhenConsoleProcessExits.KeepConsoleEmulatorAndShowMessage,
                AnsiStreamChunkReceivedEventSink = outputProcessor.AnsiStreamChunkReceived,
                StartupDirectory = workDir
            };

            if (AppSettings.ConEmuStyle.ValueOrDefault != "Default")
            {
                startInfo.ConsoleProcessExtraArgs = " -new_console:P:\"" + AppSettings.ConEmuStyle.ValueOrDefault + "\"";
            }

            foreach (var(name, value) in envVariables)
            {
                startInfo.SetEnv(name, value);
            }

            var operation = CommandLog.LogProcessStart(command, arguments);

            startInfo.ConsoleProcessExitedEventSink = (_, args) =>
            {
                _nLastExitCode = args.ExitCode;
                operation.LogProcessEnd(_nLastExitCode);
                outputProcessor.Flush();
                FireProcessExited();
            };

            startInfo.ConsoleEmulatorClosedEventSink = (sender, _) =>
            {
                if (sender == _terminal.RunningSession)
                {
                    FireTerminated();
                }
            };

            _terminal.Start(startInfo, ThreadHelper.JoinableTaskFactory);
        }