コード例 #1
0
ファイル: UnmountVerb.cs プロジェクト: theryee/VFSForGit
        private void AcquireLock(string enlistmentRoot)
        {
            string pipeName = Paths.GetNamedPipeName(enlistmentRoot);

            using (NamedPipeClient pipeClient = new NamedPipeClient(pipeName))
            {
                try
                {
                    if (!pipeClient.Connect())
                    {
                        this.ReportErrorAndExit("Unable to connect to GVFS while acquiring lock to unmount.  Try 'gvfs status' to verify if the repo is mounted.");
                        return;
                    }

                    Process currentProcess = Process.GetCurrentProcess();
                    string  result         = null;
                    if (!GVFSLock.TryAcquireGVFSLockForProcess(
                            this.Unattended,
                            pipeClient,
                            "gvfs unmount",
                            currentProcess.Id,
                            GVFSPlatform.Instance.IsElevated(),
                            checkAvailabilityOnly: false,
                            gvfsEnlistmentRoot: enlistmentRoot,
                            result: out result))
                    {
                        this.ReportErrorAndExit("Unable to acquire the lock prior to unmount. " + result);
                    }
                }
                catch (BrokenPipeException)
                {
                    this.ReportErrorAndExit("Unable to acquire the lock prior to unmount.  Try 'gvfs status' to verify if the repo is mounted.");
                }
            }
        }
コード例 #2
0
        private static void AcquireLock(string enlistmentPipename)
        {
            using (NamedPipeClient pipeClient = new NamedPipeClient(enlistmentPipename))
            {
                if (!pipeClient.Connect())
                {
                    throw new Exception("The repo does not appear to be mounted. Use 'gvfs status' to check.");
                }

                int pid = Process.GetCurrentProcess().Id;

                string result;
                if (!GVFSLock.TryAcquireGVFSLockForProcess(
                        unattended: false,
                        pipeClient: pipeClient,
                        fullCommand: AcquireGVFSLockVerb.fullCommand,
                        pid: pid,
                        isElevated: false,
                        isConsoleOutputRedirectedToFile: false,
                        checkAvailabilityOnly: false,
                        gvfsEnlistmentRoot: null,
                        gitCommandSessionId: string.Empty,
                        result: out result))
                {
                    throw new Exception(result);
                }
            }
        }
コード例 #3
0
        private void AcquireLock(string enlistmentRoot)
        {
            string pipeName = Paths.GetNamedPipeName(enlistmentRoot);

            using (NamedPipeClient pipeClient = new NamedPipeClient(pipeName))
            {
                try
                {
                    if (!pipeClient.Connect())
                    {
                        this.ReportErrorAndExit("Unable to connect to GVFS while acquiring lock to unmount.  Try 'gvfs status' to verify if the repo is mounted.");
                        return;
                    }

                    Process currentProcess = Process.GetCurrentProcess();
                    string  result         = null;
                    if (!GVFSLock.TryAcquireGVFSLockForProcess(
                            pipeClient,
                            "gvfs unmount",
                            currentProcess.Id,
                            currentProcess,
                            enlistmentRoot,
                            out result))
                    {
                        this.ReportErrorAndExit("Unable to acquire the lock prior to unmount. " + result);
                    }
                }
                catch (BrokenPipeException)
                {
                    this.ReportErrorAndExit("Unable to acquire the lock prior to unmount.  Try 'gvfs status' to verify if the repo is mounted.");
                }
            }
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: noonnee/GVFS
        private static void AcquireGVFSLockForProcess(string fullCommand, int pid, Process parentProcess, NamedPipeClient pipeClient)
        {
            string result;

            if (!GVFSLock.TryAcquireGVFSLockForProcess(
                    pipeClient,
                    fullCommand,
                    pid,
                    parentProcess,
                    null, // gvfsEnlistmentRoot
                    out result))
            {
                ExitWithError(result);
            }
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: smodin/GVFS
        private static void AcquireGVFSLockForProcess(bool unattended, string fullCommand, int pid, Process parentProcess, NamedPipeClient pipeClient)
        {
            string result;

            if (!GVFSLock.TryAcquireGVFSLockForProcess(
                    unattended,
                    pipeClient,
                    fullCommand,
                    pid,
                    ProcessHelper.IsAdminElevated(),
                    parentProcess,
                    null, // gvfsEnlistmentRoot
                    out result))
            {
                ExitWithError(result);
            }
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: theryee/VFSForGit
        private static void AcquireGVFSLockForProcess(bool unattended, string[] args, int pid, NamedPipeClient pipeClient)
        {
            string result;
            bool   checkGvfsLockAvailabilitOnly = CheckGVFSLockAvailabilityOnly(args);
            string fullCommand = GenerateFullCommand(args);

            if (!GVFSLock.TryAcquireGVFSLockForProcess(
                    unattended,
                    pipeClient,
                    fullCommand,
                    pid,
                    WindowsPlatform.IsElevatedImplementation(),
                    checkGvfsLockAvailabilitOnly,
                    null, // gvfsEnlistmentRoot
                    out result))
            {
                ExitWithError(result);
            }
        }
コード例 #7
0
        private static void AcquireGVFSLockForProcess(bool unattended, string[] args, int pid, Process parentProcess, NamedPipeClient pipeClient)
        {
            string result;
            bool   checkGvfsLockAvailabilitOnly = CheckGVFSLockAvailabilityOnly(args);
            string fullCommand = GenerateFullCommand(args);

            if (!GVFSLock.TryAcquireGVFSLockForProcess(
                    unattended,
                    pipeClient,
                    fullCommand,
                    pid,
                    ProcessHelper.IsAdminElevated(),
                    checkGvfsLockAvailabilitOnly,
                    parentProcess,
                    null, // gvfsEnlistmentRoot
                    out result))
            {
                ExitWithError(result);
            }
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: xnohat/VFSForGit
        private static void AcquireGVFSLockForProcess(bool unattended, string[] args, int pid, NamedPipeClient pipeClient)
        {
            string result;
            bool   checkGvfsLockAvailabilityOnly = CheckGVFSLockAvailabilityOnly(args);
            string fullCommand = GenerateFullCommand(args);

            if (!GVFSLock.TryAcquireGVFSLockForProcess(
                    unattended,
                    pipeClient,
                    fullCommand,
                    pid,
                    GVFSHooksPlatform.IsElevated(),
                    isConsoleOutputRedirectedToFile: GVFSHooksPlatform.IsConsoleOutputRedirectedToFile(),
                    checkAvailabilityOnly: checkGvfsLockAvailabilityOnly,
                    gvfsEnlistmentRoot: null,
                    result: out result))
            {
                ExitWithError(result);
            }
        }