Exemplo n.º 1
0
        public string Compile(ProtobufCompilerWrapperOptions options)
        {
            var protocCommand = GenerateProtocCommand(options);

            var escapedProtocCommand = protocCommand.Replace("\"", "\\\"");

            var protocProcess = new Process
            {
                StartInfo = new ProcessStartInfo
                {
                    FileName  = "/bin/bash",
                    Arguments = $"-c \"{protocCommand}\"",
                    RedirectStandardOutput = true,
                    RedirectStandardError  = true,
                    UseShellExecute        = false,
                    CreateNoWindow         = true
                }
            };

            protocProcess.Start();
            protocProcess.WaitForExit();

            // Get output
            var outputStream = protocProcess.StandardError;

            return(outputStream.ReadToEnd());
        }
Exemplo n.º 2
0
 private string GenerateProtocCommand(ProtobufCompilerWrapperOptions options)
 {
     // Not ideal
     return($"cd {InputPath} && protoc --{options.OutputType}_out={OutputPath} * && cd {OutputPath} && find . -type f -print0 | xargs -0 todos");
 }