isUnix() публичный статический Метод

public static isUnix ( ) : bool
Результат bool
Пример #1
0
 public void ShutDownHotrodServer()
 {
     Console.WriteLine("Shutting down Infinispan Server ...");
     if (hrServer != null)
     {
         if (PlatformUtils.isUnix())
         {
             /* Kill the process and subprocesses. */
             Process killProcess = new Process();
             killProcess.StartInfo.FileName  = "bash";
             killProcess.StartInfo.Arguments = String.Format("-c \"ps h --format pid --pid {0} --ppid {0} | xargs kill\"", hrServer.Id);
             killProcess.Start();
             killProcess.WaitForExit();
         }
         else
         {
             /* Kill the process and subprocesses. */
             Process killProcess = new Process();
             killProcess.StartInfo.FileName  = "taskkill";
             killProcess.StartInfo.Arguments = String.Format("/PID {0} /T /F", hrServer.Id);
             killProcess.Start();
             killProcess.WaitForExit();
         }
         Assert.IsTrue(IsStopped(),
                       "A process is still listening on the ip/port. Kill failed?");
         hrServer.Close();
     }
 }
Пример #2
0
 private string buildStartCommand(string homePath)
 {
     if (PlatformUtils.isUnix())
     {
         return(Path.Combine(homePath, "bin/server.sh"));
     }
     else
     {
         return(Path.Combine(homePath, "bin\\server.bat"));
     }
 }
Пример #3
0
        void StartHotrodServerInternal()
        {
            var jbossHome = Environment.GetEnvironmentVariable("JBOSS_HOME");
            var path      = Environment.GetEnvironmentVariable("PATH");

            Console.WriteLine("PATH= " + path);
            if (jbossHome == null)
            {
                throw new Exception("JBOSS_HOME env variable not set.");
            }

            Assert.IsTrue(IsStopped(),
                          "Another process already listening on the same ip/port.");
            // Cleanup data dir
            if (PlatformUtils.isUnix())
            {
                Directory.Delete(Path.Combine(jbossHome, serverHome + "/data"), true);
            }
            else
            {
                Directory.Delete(Path.Combine(jbossHome, serverHome + "\\data"), true);
            }
            hrServer = new Process
            {
                StartInfo =
                {
                    FileName        = buildStartCommand(jbossHome),
                    Arguments       = "-c " + configurationFile,
                    UseShellExecute = false
                }
            };
            if (arguments.Length != 0)
            {
                hrServer.StartInfo.Arguments = hrServer.StartInfo.Arguments + " " + arguments;
            }
            hrServer.StartInfo.UseShellExecute = false;
            hrServer.StartInfo.EnvironmentVariables["NOPAUSE"] = "YES";
            if (PlatformUtils.isUnix())
            {
                // Drop the output generated by the server on the console (data present in log file).
                hrServer.StartInfo.RedirectStandardOutput = true;
                hrServer.StartInfo.RedirectStandardError  = true;
                hrServer.OutputDataReceived += new DataReceivedEventHandler(DropOutputHandler);
                hrServer.ErrorDataReceived  += new DataReceivedEventHandler(DropOutputHandler);
            }
            hrServer.Start();


            Assert.IsTrue(IsRunning(),
                          "Server not listening on the expected ip/port.");
        }