Esempio n. 1
0
        private async Task <int> ExecuteGitCommandAsync(RunnerActionPluginExecutionContext context, string repoRoot, string command, string options, string additionalCommandLine, CancellationToken cancellationToken)
        {
            string arg = StringUtil.Format($"{additionalCommandLine} {command} {options}").Trim();

            context.Command($"git {arg}");

            var processInvoker = new ProcessInvoker(context);

            processInvoker.OutputDataReceived += delegate(object sender, ProcessDataReceivedEventArgs message)
            {
                context.Output(message.Data);
            };

            processInvoker.ErrorDataReceived += delegate(object sender, ProcessDataReceivedEventArgs message)
            {
                context.Output(message.Data);
            };

            return(await processInvoker.ExecuteAsync(
                       workingDirectory : repoRoot,
                       fileName : gitPath,
                       arguments : arg,
                       environment : gitEnv,
                       requireExitCodeZero : false,
                       outputEncoding : s_encoding,
                       cancellationToken : cancellationToken));
        }