Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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;
        }
Esempio n. 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);
        }