Example #1
0
        public static Process ExecNormal(GitInput input)
        {
            Verify.Argument.IsNotNull(input, "input");

            var psi = new ProcessStartInfo()
            {
                Arguments       = input.GetArguments(),
                WindowStyle     = ProcessWindowStyle.Normal,
                UseShellExecute = false,
                LoadUserProfile = true,
                FileName        = _gitExePath,
                ErrorDialog     = false,
                CreateNoWindow  = true,
            };

            if (!string.IsNullOrEmpty(input.WorkingDirectory))
            {
                psi.WorkingDirectory = input.WorkingDirectory;
            }
            if (input.Environment != null)
            {
                foreach (var opt in input.Environment)
                {
                    psi.EnvironmentVariables[opt.Key] = opt.Value;
                }
            }
            SetCriticalEnvironmentVariables(psi);
            return(Process.Start(psi));
        }
Example #2
0
        public static GitOutput Execute(GitInput input)
        {
            Verify.Argument.IsNotNull(input, "input");

            var stdOutReader = new AsyncTextReader();
            var stdErrReader = new AsyncTextReader();
            var executor     = new GitProcessExecutor(GitExePath);
            var exitCode     = executor.Execute(input, stdOutReader, stdErrReader);

            return(new GitOutput(
                       stdOutReader.GetText(),
                       stdErrReader.GetText(),
                       exitCode));
        }
Example #3
0
        public static GitOutput Execute(GitInput input)
        {
            Verify.Argument.IsNotNull(input, "input");

            var stdOutReader = new AsyncTextReader();
            var stdErrReader = new AsyncTextReader();
            var executor = new GitProcessExecutor(GitExePath);
            var exitCode = executor.Execute(input, stdOutReader, stdErrReader);
            return new GitOutput(
                stdOutReader.GetText(),
                stdErrReader.GetText(),
                exitCode);
        }
Example #4
0
        public static Process ExecNormal(GitInput input)
        {
            Verify.Argument.IsNotNull(input, "input");

            var psi = new ProcessStartInfo()
            {
                Arguments = input.GetArguments(),
                WindowStyle = ProcessWindowStyle.Normal,
                UseShellExecute = false,
                LoadUserProfile = true,
                FileName = _gitExePath,
                ErrorDialog = false,
                CreateNoWindow = true,
            };
            if(!string.IsNullOrEmpty(input.WorkingDirectory))
            {
                psi.WorkingDirectory = input.WorkingDirectory;
            }
            if(input.Environment != null)
            {
                foreach(var opt in input.Environment)
                {
                    psi.EnvironmentVariables[opt.Key] = opt.Value;
                }
            }
            SetCriticalEnvironmentVariables(psi);
            return Process.Start(psi);
        }