// Respond license questions with the "response". public void CheckAndRespond(System.Diagnostics.Process process, StreamWriter stdin, CommandLine.StreamData data) { if (process.HasExited) return; if ((data.data != null && data.text.Contains(Question)) || CommandLine.LineReader.Aggregate(GetBufferedData(0)).text.Contains(Question)) { Flush(); // Ignore I/O exceptions as this could race with the process exiting. try { foreach (byte b in System.Text.Encoding.UTF8.GetBytes( response + System.Environment.NewLine)) { stdin.BaseStream.WriteByte(b); } stdin.BaseStream.Flush(); } catch (System.IO.IOException) { } } }