Exemplo n.º 1
0
        private void StreamReaderThreadFunc()
        {
            if (!Process.StartInfo.RedirectStandardOutput)
            {
                return;
            }
            var streamReader = Process.StandardOutput;

            if (streamReader == null)
            {
                return;
            }
            try
            {
                while (!streamReader.EndOfStream)
                {
                    string s = streamReader.ReadLine();
                    if (s == null)
                    {
                        return;
                    }
                    lock (OutputText)
                    {
                        OutputText.Add(s);
                    }
                }
            }
            catch (Exception ex)
            {
                lock (Exceptions)
                {
                    Exceptions.Add(ex);
                }
            }
        }