bool LaunchProcesses(List <ProcessStartData> processes, string name)
        {
            if (processManager == null)
            {
                processManager = new ProcessManager();
                processManager.OnProcessExit += (processName, exitCode) =>
                                                StopWithException(new ProcessExecutionException(
                                                                      $"{processName} exited with exit code {exitCode}",
                                                                      exitCode));
            }

            foreach (var item in processes)
            {
                try
                {
                    LaunchYetiProcess(item);
                }
                catch (ProcessException e)
                {
                    Trace.WriteLine($"Failed to start {item.Name}: {e.Message}");
                    dialogUtil.ShowError(ErrorStrings.FailedToStartRequiredProcess(e.Message),
                                         e.ToString());
                    return(false);
                }
            }

            Trace.WriteLine($"Manager successfully started all {name} processes");
            return(true);
        }
Beispiel #2
0
        List <string> ReadMountsContentOrDefault(Gamelet gamelet, ActionRecorder actionRecorder)
        {
            List <string>   content       = new List <string>();
            ICancelableTask getMountsTask =
                _cancelableTaskFactory.Create(TaskMessages.CheckingMountInfo, async _ => {
                content = await _remoteCommand.RunWithSuccessCapturingOutputAsync(
                    new SshTarget(gamelet), ReadMountsCmd) ?? new List <string>();
            });

            try
            {
                getMountsTask.RunAndRecord(actionRecorder, ActionType.GameletReadMounts);
                return(content);
            }
            catch (ProcessException e)
            {
                Trace.WriteLine($"Error reading /proc/mounts file: {e.Message}");
                _dialogUtil.ShowError(ErrorStrings.FailedToStartRequiredProcess(e.Message),
                                      e.ToString());
                return(content);
            }
            finally
            {
                string joinedContent = string.Join("\n\t", content);
                Trace.WriteLine($"Gamelet /proc/mounts:{Environment.NewLine}{joinedContent}");
            }
        }