public void Run() { isBusy = true; progress.UpdateProgress(0, 100, "Initializing..."); if (firstRun) { UsageTracker.IncrementNumberOfStartups(); } var thread = new Thread(() => { GitInstallationState state = new GitInstallationState(); try { if (Environment.IsMac) { var getEnvPath = new SimpleProcessTask(TaskManager.Token, "bash".ToNPath(), "-c \"/usr/libexec/path_helper\"") .Configure(ProcessManager, dontSetupGit: true) .Catch(e => true); // make sure this doesn't throw if the task fails var path = getEnvPath.RunSynchronously(); if (getEnvPath.Successful) { Logger.Trace("Existing Environment Path Original:{0} Updated:{1}", Environment.Path, path); Environment.Path = path?.Split(new[] { "\"" }, StringSplitOptions.None)[1]; } } progress.UpdateProgress(20, 100, "Setting up octorun..."); Environment.OctorunScriptPath = new OctorunInstaller(Environment, TaskManager) .SetupOctorunIfNeeded(); progress.UpdateProgress(50, 100, "Setting up git..."); state = Environment.GitInstallationState; if (!state.GitIsValid && !state.GitLfsIsValid && FirstRun) { // importing old settings NPath gitExecutablePath = Environment.SystemSettings.Get(Constants.GitInstallPathKey, NPath.Default); if (gitExecutablePath.IsInitialized) { Environment.SystemSettings.Unset(Constants.GitInstallPathKey); state.GitExecutablePath = gitExecutablePath; state.GitInstallationPath = gitExecutablePath.Parent.Parent; Environment.GitInstallationState = state; } } var installer = new GitInstaller(Environment, ProcessManager, TaskManager.Token); installer.Progress(progressReporter.UpdateProgress); if (state.GitIsValid && state.GitLfsIsValid) { if (firstRun) { installer.ValidateGitVersion(state); if (state.GitIsValid) { installer.ValidateGitLfsVersion(state); } } } if (!state.GitIsValid || !state.GitLfsIsValid) { state = installer.RunSynchronously(); } SetupGit(state); progress.UpdateProgress(80, 100, "Initializing repository..."); if (state.GitIsValid && state.GitLfsIsValid) { RestartRepository(); } progress.UpdateProgress(100, 100, "Initialized"); } catch (Exception ex) { Logger.Error(ex, "A problem ocurred setting up Git"); progress.UpdateProgress(90, 100, "Initialization failed"); } new ActionTask <bool>(TaskManager.Token, (s, gitIsValid) => { InitializationComplete(); if (gitIsValid) { InitializeUI(); } }, () => state.GitIsValid && state.GitLfsIsValid) { Affinity = TaskAffinity.UI } .Start(); }); thread.Start(); }