private Client Run(string cmd, params string[] packagesAndArguments) { var args = new List <object> { cmd, "-y" }; args.AddRange(packagesAndArguments); var result = Shell.RunAndGetExitCodeMS(GetChocoExecutable(), args.ToArray()); GenLog.Info("Chocolatey command done"); switch (result) { case 0: break; case 1641: _interactionHandler.ExitWithSuccess("Exiting for reboot"); break; case 3010: AskForRestart(); break; default: _interactionHandler.ExitWithError("Chocolatey failed"); break; } return(this); }
public void Run() { try { DoWork(); InteractionHandler.ExitWithSuccess("All done"); } catch (Exception e) { GenLog.Error(e.StackTrace); InteractionHandler.ExitWithError(e.Message); } }