public RunLocalServerResponse RunLocalServer()

in Runtime/Core/GameLiftLocalTesting/GameLiftProcess.cs [173:235]


        public RunLocalServerResponse RunLocalServer(RunLocalServerRequest request)
        {
            try
            {
                if (request == null || string.IsNullOrWhiteSpace(request.FilePath) || string.IsNullOrWhiteSpace(request.ApplicationProductName))
                {
                    return Response.Fail(new RunLocalServerResponse
                    {
                        ErrorCode = ErrorCode.InvalidParameters
                    });
                }

                int processId;

                if (request.LocalOperatingSystem == LocalOperatingSystem.MAC_OS)
                {
                    // Starts a bash process to run an Apple script, which activates a new Terminal App window,
                    // and runs the game server executable in the Unity compiled .app file
                    string activateTerminalScript = $"tell application \\\"Terminal\\\" to activate";
                    string setGameServerFilePath = $"set GameServerFilePathEnvVar to \\\"{request.FilePath}\\\"";
                    string runGameServerScript = $"GameServerFilePathEnvVar";
                    string runGameServer = $"tell application \\\"Terminal\\\" to do script {runGameServerScript}";
                    string osaScript = $"osascript -e \'{activateTerminalScript}\' -e \'{setGameServerFilePath}\' -e \'{runGameServer}\'";
                    string bashCommand = $" -c \"{osaScript}\"";

                    ProcessStartInfo processStartInfo = new ProcessStartInfo
                    {
                        UseShellExecute = false,
                        RedirectStandardOutput = true,
                        FileName = "/bin/bash",
                        CreateNoWindow = false,
                        Arguments = bashCommand
                    };

                    processId = ExecuteMacOsTerminalCommand(processStartInfo);
                }
                else
                {
                    ProcessStartInfo processStartInfo = new ProcessStartInfo
                    {
                        UseShellExecute = request.ShowWindow,
                        FileName = request.FilePath
                    };

                    processId = _processWrapper.Start(processStartInfo);
                }

                return Response.Ok(new RunLocalServerResponse
                {
                    ProcessId = processId
                });
            }
            catch (Exception ex)
            {
                Logger.LogError(ex, ex.Message);

                return Response.Fail(new RunLocalServerResponse
                {
                    ErrorCode = ErrorCode.UnknownError,
                    ErrorMessage = ex.Message
                });
            }
        }