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}"); } }
GameletMountChecker CreateMountCheckerWithSpecifiedProcMountsInfo( List <string> procMountsContent) { _remoteCommand .RunWithSuccessCapturingOutputAsync(new SshTarget(_gamelet), GameletMountChecker.ReadMountsCmd) .Returns(Task.FromResult(procMountsContent)); return(new GameletMountChecker(_remoteCommand, _dialogUtil, _cancelableTaskFactory)); }