Exemple #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);
        }
Exemple #2
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;
        }
Exemple #3
0
        public static Launcher Launch(Settings settings)
        {
            var process = StartOnFirstFreePort(settings);

              return new Launcher(process.Item1, process.Item2);
        }