Example #1
0
        static Tuple<Process, int> StartOnFirstFreePort(Settings settings)
        {
            do
              {
            try
            {
              Console.WriteLine("Trying to start {0} {1} on port {2}",
                            settings.Executable,
                            settings.Arguments(settings),
                            settings.Port);

              var process = StartProcess(settings);

              Console.WriteLine("Started [{0}] {1} on port {2}", process.Id, settings.Executable, settings.Port);
              settings.Started(process, settings);

              return new Tuple<Process, int>(process, settings.Port);
            }
            catch (Exception ex)
            {
              Console.WriteLine(ex.Message);
            }

            settings = settings.TryNextPort();
              }
              while (true);
        }
Example #2
0
        static Tuple <Process, int> StartOnFirstFreePort(Settings settings)
        {
            do
            {
                try
                {
                    Console.WriteLine("Trying to start {0} {1} on port {2}",
                                      settings.Executable,
                                      settings.Arguments(settings),
                                      settings.Port);

                    var process = StartProcess(settings);

                    Console.WriteLine("Started [{0}] {1} on port {2}", process.Id, settings.Executable, settings.Port);
                    settings.Started(process, settings);

                    return(new Tuple <Process, int>(process, settings.Port));
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }

                settings = settings.TryNextPort();
            }while (true);
        }
Example #3
0
        static Process StartProcess(Settings settings)
        {
            var process = Process.Start(new ProcessStartInfo
              {
            FileName = settings.Executable,
            Arguments = settings.Arguments(settings),
            UseShellExecute = false,
            RedirectStandardError = true,
            RedirectStandardOutput = true
              });

              settings.CheckStarted(process);

              return process;
        }
Example #4
0
        static Process StartProcess(Settings settings)
        {
            var process = Process.Start(new ProcessStartInfo
            {
                FileName               = settings.Executable,
                Arguments              = settings.Arguments(settings),
                UseShellExecute        = false,
                RedirectStandardError  = true,
                RedirectStandardOutput = true
            });

            settings.CheckStarted(process);

            return(process);
        }