public static ActionResult InstallAction()

in src/installer/BeatPackageCompiler/AgentCustomAction.cs [11:42]


        public static ActionResult InstallAction(Session session)
        {
            try
            {
                string install_args = string.Empty;

                if (!string.IsNullOrEmpty(session["INSTALLARGS"]))
                    install_args = session["INSTALLARGS"];
                else
                    session.Log("No INSTALLARGS detected");

                System.Diagnostics.Process process = new System.Diagnostics.Process();
                process.StartInfo.FileName = Path.Combine(session["INSTALLDIR"], "elastic-agent.exe");
                process.StartInfo.Arguments = "install -f " + install_args;
                StartProcess(session, process);

                session.Log("Agent install return code:" + process.ExitCode);

                if (process.ExitCode == 0)
                {
                    // If agent got installed properly, we can go ahead and remove all the files installed by the MSI (best effort)
                    RemoveFolder(session, session["INSTALLDIR"]);
                }

                return process.ExitCode == 0 ? ActionResult.Success : ActionResult.Failure;
            }
            catch (Exception ex)
            {
                session.Log("Exception: " + ex.ToString());
                return ActionResult.Failure;
            }
        }