Exemple #1
0
        private string CallGVFS(string args, bool failOnError = false, string trace = null)
        {
            ProcessStartInfo processInfo = null;

            processInfo           = new ProcessStartInfo(this.pathToGVFS);
            processInfo.Arguments = args + " " + TestConstants.InternalUseOnlyFlag + " " + GVFSHelpers.GetInternalParameter();

            processInfo.WindowStyle            = ProcessWindowStyle.Hidden;
            processInfo.UseShellExecute        = false;
            processInfo.RedirectStandardOutput = true;

            if (trace != null)
            {
                processInfo.EnvironmentVariables["GIT_TRACE"] = trace;
            }

            using (Process process = Process.Start(processInfo))
            {
                string result = process.StandardOutput.ReadToEnd();
                process.WaitForExit();

                if (failOnError)
                {
                    process.ExitCode.ShouldEqual(0, result);
                }

                return(result);
            }
        }