private bool TryMount(ITracer tracer, GVFSEnlistment enlistment, string mountExecutableLocation, out string errorMessage) { if (!GVFSVerb.TrySetRequiredGitConfigSettings(enlistment)) { errorMessage = "Unable to configure git repo"; return(false); } const string ParamPrefix = "--"; tracer.RelatedInfo($"{nameof(this.TryMount)}: Launching background process('{mountExecutableLocation}') for {enlistment.EnlistmentRoot}"); GVFSPlatform.Instance.StartBackgroundVFS4GProcess( tracer, mountExecutableLocation, new[] { enlistment.EnlistmentRoot, ParamPrefix + GVFSConstants.VerbParameters.Mount.Verbosity, this.Verbosity, ParamPrefix + GVFSConstants.VerbParameters.Mount.Keywords, this.KeywordsCsv, ParamPrefix + GVFSConstants.VerbParameters.Mount.StartedByService, this.StartedByService.ToString(), ParamPrefix + GVFSConstants.VerbParameters.Mount.StartedByVerb, true.ToString() }); tracer.RelatedInfo($"{nameof(this.TryMount)}: Waiting for repo to be mounted"); return(GVFSEnlistment.WaitUntilMounted(tracer, enlistment.EnlistmentRoot, this.Unattended, out errorMessage)); }
private bool TryMount(ITracer tracer, GVFSEnlistment enlistment, string mountExecutableLocation, out string errorMessage) { if (!GVFSVerb.TrySetRequiredGitConfigSettings(enlistment)) { errorMessage = "Unable to configure git repo"; return(false); } const string ParamPrefix = "--"; GVFSPlatform.Instance.StartBackgroundProcess( tracer, mountExecutableLocation, new[] { enlistment.EnlistmentRoot, ParamPrefix + GVFSConstants.VerbParameters.Mount.Verbosity, this.Verbosity, ParamPrefix + GVFSConstants.VerbParameters.Mount.Keywords, this.KeywordsCsv, ParamPrefix + GVFSConstants.VerbParameters.Mount.StartedByService, this.StartedByService.ToString() }); return(GVFSEnlistment.WaitUntilMounted(enlistment.EnlistmentRoot, this.Unattended, out errorMessage)); }
public bool Mount(string repoRoot) { if (!ProjFSFilter.IsServiceRunning(this.tracer)) { string error; if (!EnableAndAttachProjFSHandler.TryEnablePrjFlt(this.tracer, out error)) { this.tracer.RelatedError($"{nameof(this.Mount)}: Unable to start the GVFS.exe process: {error}"); } } if (!this.CallGVFSMount(repoRoot)) { this.tracer.RelatedError($"{nameof(this.Mount)}: Unable to start the GVFS.exe process."); return(false); } string errorMessage; if (!GVFSEnlistment.WaitUntilMounted(repoRoot, false, out errorMessage)) { this.tracer.RelatedError(errorMessage); return(false); } return(true); }
private bool TryMount(GVFSEnlistment enlistment, string mountExecutableLocation, out string errorMessage) { if (!GVFSVerb.TrySetRequiredGitConfigSettings(enlistment)) { errorMessage = "Unable to configure git repo"; return(false); } const string ParamPrefix = "--"; if (GVFSPlatform.Instance.IsUnderConstruction) { mountExecutableLocation = Path.Combine(ProcessHelper.GetCurrentProcessLocation(), "gvfs.mount"); } GVFSPlatform.Instance.StartBackgroundProcess( mountExecutableLocation, new[] { enlistment.EnlistmentRoot, ParamPrefix + GVFSConstants.VerbParameters.Mount.Verbosity, this.Verbosity, ParamPrefix + GVFSConstants.VerbParameters.Mount.Keywords, this.KeywordsCsv }); if (GVFSPlatform.Instance.IsUnderConstruction) { // TODO(Mac): figure out the timing issue here on connecting to the pipe System.Threading.Thread.Sleep(TimeSpan.FromSeconds(1)); } return(GVFSEnlistment.WaitUntilMounted(enlistment.EnlistmentRoot, this.Unattended, out errorMessage)); }
public bool MountRepository(string repoRoot, int sessionId) { if (!ProjFSFilter.IsServiceRunning(this.tracer)) { string error; if (!EnableAndAttachProjFSHandler.TryEnablePrjFlt(this.tracer, out error)) { this.tracer.RelatedError($"{nameof(this.MountRepository)}: Could not enable PrjFlt: {error}"); return(false); } } using (CurrentUser currentUser = new CurrentUser(this.tracer, sessionId)) { if (!this.CallGVFSMount(repoRoot, currentUser)) { this.tracer.RelatedError($"{nameof(this.MountRepository)}: Unable to start the GVFS.exe process."); return(false); } string errorMessage; if (!GVFSEnlistment.WaitUntilMounted(repoRoot, false, out errorMessage)) { this.tracer.RelatedError(errorMessage); return(false); } } return(true); }
public bool Mount(string repoRoot) { string error; string warning; if (!GvFltFilter.IsHealthy(out error, out warning, this.tracer)) { return(false); } this.CheckAntiVirusExclusion(this.tracer, repoRoot); string unusedMessage; if (!GvFltFilter.TryAttach(this.tracer, repoRoot, out unusedMessage)) { return(false); } if (!this.CallGVFSMount(repoRoot)) { this.tracer.RelatedError("Unable to start the GVFS.Mount process."); return(false); } string errorMessage; if (!GVFSEnlistment.WaitUntilMounted(repoRoot, out errorMessage)) { this.tracer.RelatedError(errorMessage); return(false); } return(true); }
public bool Mount(string repoRoot) { if (!this.CallGVFSMount(repoRoot)) { this.tracer.RelatedError($"{nameof(this.Mount)}: Unable to start the GVFS process."); return(false); } string errorMessage; if (!GVFSEnlistment.WaitUntilMounted(repoRoot, false, out errorMessage)) { this.tracer.RelatedError(errorMessage); return(false); } return(true); }
private bool TryMount(GVFSEnlistment enlistment, out string errorMessage) { // We have to parse these parameters here to make sure they are valid before // handing them to the background process which cannot tell the user when they are bad EventLevel verbosity; Keywords keywords; this.ParseEnumArgs(out verbosity, out keywords); string mountExeLocation = Path.Combine(ProcessHelper.GetCurrentProcessLocation(), GVFSConstants.MountExecutableName); if (!File.Exists(mountExeLocation)) { errorMessage = "Could not find GVFS.Mount.exe. You may need to reinstall GVFS."; return(false); } GitProcess git = new GitProcess(enlistment); if (!git.IsValidRepo()) { errorMessage = "The physical git repo is missing or invalid"; return(false); } this.SetGitConfigSettings(git); const string ParamPrefix = "--"; ProcessHelper.StartBackgroundProcess( mountExeLocation, string.Join( " ", enlistment.EnlistmentRoot, ParamPrefix + GVFSConstants.VerbParameters.Mount.Verbosity, this.Verbosity, ParamPrefix + GVFSConstants.VerbParameters.Mount.Keywords, this.KeywordsCsv, this.ShowDebugWindow ? ParamPrefix + GVFSConstants.VerbParameters.Mount.DebugWindow : string.Empty), createWindow: this.ShowDebugWindow); return(GVFSEnlistment.WaitUntilMounted(enlistment.EnlistmentRoot, out errorMessage)); }
public bool Mount(string repoRoot) { string error; if (!GvFltFilter.IsHealthy(out error, this.tracer)) { return(false); } // Ensure the repo is excluded from antivirus before calling 'gvfs mount' // to reduce chatter between GVFS.exe and GVFS.Service.exe string errorMessage; bool isExcluded; ExcludeFromAntiVirusHandler.CheckAntiVirusExclusion(this.tracer, repoRoot, out isExcluded, out errorMessage); string unusedMessage; if (!GvFltFilter.TryAttach(this.tracer, repoRoot, out unusedMessage)) { return(false); } if (!this.CallGVFSMount(repoRoot)) { this.tracer.RelatedError("Unable to start the GVFS.exe process."); return(false); } if (!GVFSEnlistment.WaitUntilMounted(repoRoot, false, out errorMessage)) { this.tracer.RelatedError(errorMessage); return(false); } return(true); }
private bool TryMount(GVFSEnlistment enlistment, string mountExeLocation, out string errorMessage) { if (!GVFSVerb.TrySetGitConfigSettings(enlistment)) { errorMessage = "Unable to configure git repo"; return(false); } const string ParamPrefix = "--"; ProcessHelper.StartBackgroundProcess( mountExeLocation, string.Join( " ", enlistment.EnlistmentRoot, ParamPrefix + GVFSConstants.VerbParameters.Mount.Verbosity, this.Verbosity, ParamPrefix + GVFSConstants.VerbParameters.Mount.Keywords, this.KeywordsCsv, this.ShowDebugWindow ? ParamPrefix + GVFSConstants.VerbParameters.Mount.DebugWindow : string.Empty), createWindow: this.ShowDebugWindow); return(GVFSEnlistment.WaitUntilMounted(enlistment.EnlistmentRoot, this.Unattended, out errorMessage)); }
public virtual bool WaitUntilMounted(ITracer tracer, string enlistmentRoot, bool unattended, out string errorMessage) { return(GVFSEnlistment.WaitUntilMounted(tracer, enlistmentRoot, unattended: false, errorMessage: out errorMessage)); }