Esempio n. 1
0
        protected string[] RunCommand(string exeName, ArgBuilder args, ICredentials creds, string workingDir)
        {
            var provider = this as IScmProvider;

            if (String.IsNullOrEmpty(exeName))
            {
                exeName = DefaultExeName;
            }

            var h = new CmdLineHelper(workingDir)
            {
                CredentialsString = provider?.FormatCredentials(creds)
            };
            var result = h.Call(exeName, args.ToString());

            if (provider != null)
            {
                if (provider.IsError(h.LastExitCode))
                {
                    throw new Exception($"SCM provider {provider.Name} returned exit code '{h.LastExitCode}'.");
                }
            }

            return(result);
        }