Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Diagnostics;
- using CMSlib.ConsoleModule.Termios;
- string[] output;
- using (var process = new Process())
- {
- process.StartInfo.FileName = "sh";
- process.StartInfo.Arguments = @"-c ""echo | gcc -E -Wp,-v -""";
- process.StartInfo.RedirectStandardError = true;
- process.StartInfo.RedirectStandardOutput = true;
- process.Start();
- process.WaitForExit();
- output = process.StandardError.ReadToEnd()
- .Split(" ")
- .Select(line => line.Split('\n'))
- .SelectMany(line => line)
- .Where(line => line.Contains("include") && !line.Contains("ignoring") && !line.Contains('#') && System)
- .Select(line => line.Trim())
- .ToArray();
- Console.WriteLine(String.Join('\n', output));
- }
- var files = output.Select(directory => Directory.GetFiles(directory, "termios*.h", SearchOption.AllDirectories))
- .SelectMany(files => files);
- var handle = new TermiosHandle(0, files.ToArray());
- handle.StateSandbox(() =>
- {
- handle.EnableRaw();
- while (handle.ReadByte(out var b) != -1 && b != 'q')
- {
- Console.WriteLine(b);
- }
- });
- File.Delete("termios.h");
Add Comment
Please, Sign In to add comment